import numpy as np
import matplotlib as mpl
from matplotlib import _pylab_helpers
from matplotlib.rcsetup import interactive_bk as _interactive_bk
import matplotlib.pyplot as plt
import matplotlib.patches
from mpl_toolkits.mplot3d import Axes3D
import os
import time


def setup_for_latex(font_size=28):
    # mpl.rc("font", **{"family": "sans-serif", "sans-serif": ["Helvetica"]})
    mpl.rc("text", usetex=True)
    params = {
        "legend.fontsize": "large",
        "axes.labelsize": font_size,
        "axes.titlesize": font_size,
        "xtick.labelsize": font_size * 0.75,
        "ytick.labelsize": font_size * 0.75,
        "axes.titlepad": 25,
    }
    plt.rcParams.update(params)


def save(path, remove_axis=False, dpi=300, fig=None):
    if fig is None:
        fig = plt.gcf()
    dirname = os.path.dirname(path)
    if dirname != "" and not os.path.exists(dirname):
        os.makedirs(dirname)
    if remove_axis:
        for ax in fig.axes:
            ax.axis("off")
            ax.margins(0, 0)
        fig.subplots_adjust(
            top=1, bottom=0, right=1, left=0, hspace=0, wspace=0
        )
        for ax in fig.axes:
            ax.xaxis.set_major_locator(plt.NullLocator())
            ax.yaxis.set_major_locator(plt.NullLocator())
    fig.savefig(path, dpi=dpi, bbox_inches="tight", pad_inches=0)


def non_annoying_pause(interval, focus_figure=False):
    # interval is in seconds
    # https://github.com/matplotlib/matplotlib/issues/11131
    backend = mpl.rcParams["backend"]
    if backend in _interactive_bk:
        figManager = _pylab_helpers.Gcf.get_active()
        if figManager is not None:
            canvas = figManager.canvas
            if canvas.figure.stale:
                canvas.draw()
            if focus_figure:
                plt.show(block=False)
            canvas.start_event_loop(interval)
            return
    time.sleep(interval)


def remove_all_ticks(fig=None):
    if fig is None:
        fig = plt.gcf()
    for ax in fig.axes:
        ax.axes.get_xaxis().set_visible(False)
        ax.axes.get_yaxis().set_visible(False)


def tight_no_ticks(fig=None):
    if fig is None:
        fig = plt.gcf()
    fig.tight_layout()
    remove_all_ticks(fig=fig)


def tight_no_ticks_show(fig=None):
    tight_no_ticks()
    plt.show()


def maximize_window():
    mng = plt.get_current_fig_manager()
    mng.full_screen_toggle()


def image_colorcode(
    im_, cmap="viridis", vmin=None, vmax=None, nan_color=(1, 1, 1)
):
    cm = plt.get_cmap(cmap)
    im = im_.copy()
    if vmin is None:
        vmin = np.nanmin(im)
    if vmax is None:
        vmax = np.nanmax(im)
    mask = np.logical_not(np.isfinite(im))
    im[mask] = vmin
    im = (im.clip(vmin, vmax) - vmin) / (vmax - vmin)
    im = cm(im)
    im = im[..., :3]
    im[mask] = nan_color
    return im


def image_matrix(ims, bgval=0, x=1, y=1):
    n = len(ims)
    cols = x * int(np.ceil(np.sqrt(n / (x * y))))
    rows = y * int(np.ceil(np.sqrt(n / (x * y))))
    if (rows - 1) * cols >= n:
        rows -= 1
    if rows * (cols - 1) >= n:
        cols -= 1
    h = ims[0].shape[0]
    w = ims[0].shape[1]
    mat = np.full(
        (rows * h, cols * w, *ims[0].shape[2:]), bgval, dtype=ims[0].dtype
    )
    idx = 0
    for r in range(rows):
        for c in range(cols):
            if idx < n:
                mat[r * h : (r + 1) * h, c * w : (c + 1) * w] = ims[idx]
                idx += 1
    return mat


def image_cat2(ims, cmap="viridis", default=(0, 0, 0), max_ims_per_row=None):
    # ims ... 2d list of images
    if max_ims_per_row is not None:
        ims_ = []
        for im_row in ims:
            row = []
            for im in im_row:
                row.append(im)
                if len(row) == max_ims_per_row:
                    ims_.append(row)
                    row = []
            if len(row) > 0:
                ims_.append(row)
        ims = ims_

    rows, cols = 0, 0
    for row in ims:
        max_r, c = 0, 0
        for im in row:
            if im is None:
                continue
            h, w = im.shape[0], im.shape[1]
            max_r = max(max_r, h)
            c += w
        rows += max_r
        cols = max(cols, c)

    out = np.zeros((rows, cols, 3), dtype=im.dtype)
    out[..., :] = default
    offr = 0
    for row in ims:
        max_r, offc = 0, 0
        for im in row:
            if im is None:
                continue
            h, w = im.shape[0], im.shape[1]
            out[offr : offr + h, offc : offc + w] = im
            max_r = max(max_r, h)
            offc += w
        offr += max_r

    return out


def depthshow(depth, *args, ax=None, **kwargs):
    if ax is None:
        ax = plt.gca()
    d = depth.copy()
    d[d <= 0] = np.NaN
    ax.imshow(d, *args, **kwargs)


def normalshow(normals, *args, ax=None, **kwargs):
    if ax is None:
        ax = plt.gca()
    normals = 0.5 * normals + 0.5
    ax.imshow(normals, *args, **kwargs)


def create_ax_3d(fig=None):
    if fig is None:
        fig = plt.gcf()
    return fig.add_subplot(111, projection="3d")


def axis_equal_3d(ax=None):
    if ax is None:
        ax = plt.gca()
    extents = np.array(
        [getattr(ax, "get_{}lim".format(dim))() for dim in "xyz"]
    )
    sz = extents[:, 1] - extents[:, 0]
    centers = np.mean(extents, axis=1)
    maxsize = max(abs(sz))
    r = maxsize / 2
    for ctr, dim in zip(centers, "xyz"):
        getattr(ax, "set_{}lim".format(dim))(ctr - r, ctr + r)


def axis_label_3d(ax=None, x="x", y="y", z="z"):
    if ax is None:
        ax = plt.gca()
    ax.set_xlabel(x)
    ax.set_ylabel(y)
    ax.set_zlabel(z)


def _cmap(name, cm_data, reverse=False):
    cmap = mpl.colors.LinearSegmentedColormap.from_list(name, cm_data)
    if reverse:
        return cmap.reversed()
    else:
        return cmap


def cmap_linear_turbo(reverse=False):
    # Google AI colormap, like Jet but C2 continuous (not perceptually linear)
    cm_data = [
        [0.18995, 0.07176, 0.23217],
        [0.19483, 0.08339, 0.26149],
        [0.19956, 0.09498, 0.29024],
        [0.20415, 0.10652, 0.31844],
        [0.20860, 0.11802, 0.34607],
        [0.21291, 0.12947, 0.37314],
        [0.21708, 0.14087, 0.39964],
        [0.22111, 0.15223, 0.42558],
        [0.22500, 0.16354, 0.45096],
        [0.22875, 0.17481, 0.47578],
        [0.23236, 0.18603, 0.50004],
        [0.23582, 0.19720, 0.52373],
        [0.23915, 0.20833, 0.54686],
        [0.24234, 0.21941, 0.56942],
        [0.24539, 0.23044, 0.59142],
        [0.24830, 0.24143, 0.61286],
        [0.25107, 0.25237, 0.63374],
        [0.25369, 0.26327, 0.65406],
        [0.25618, 0.27412, 0.67381],
        [0.25853, 0.28492, 0.69300],
        [0.26074, 0.29568, 0.71162],
        [0.26280, 0.30639, 0.72968],
        [0.26473, 0.31706, 0.74718],
        [0.26652, 0.32768, 0.76412],
        [0.26816, 0.33825, 0.78050],
        [0.26967, 0.34878, 0.79631],
        [0.27103, 0.35926, 0.81156],
        [0.27226, 0.36970, 0.82624],
        [0.27334, 0.38008, 0.84037],
        [0.27429, 0.39043, 0.85393],
        [0.27509, 0.40072, 0.86692],
        [0.27576, 0.41097, 0.87936],
        [0.27628, 0.42118, 0.89123],
        [0.27667, 0.43134, 0.90254],
        [0.27691, 0.44145, 0.91328],
        [0.27701, 0.45152, 0.92347],
        [0.27698, 0.46153, 0.93309],
        [0.27680, 0.47151, 0.94214],
        [0.27648, 0.48144, 0.95064],
        [0.27603, 0.49132, 0.95857],
        [0.27543, 0.50115, 0.96594],
        [0.27469, 0.51094, 0.97275],
        [0.27381, 0.52069, 0.97899],
        [0.27273, 0.53040, 0.98461],
        [0.27106, 0.54015, 0.98930],
        [0.26878, 0.54995, 0.99303],
        [0.26592, 0.55979, 0.99583],
        [0.26252, 0.56967, 0.99773],
        [0.25862, 0.57958, 0.99876],
        [0.25425, 0.58950, 0.99896],
        [0.24946, 0.59943, 0.99835],
        [0.24427, 0.60937, 0.99697],
        [0.23874, 0.61931, 0.99485],
        [0.23288, 0.62923, 0.99202],
        [0.22676, 0.63913, 0.98851],
        [0.22039, 0.64901, 0.98436],
        [0.21382, 0.65886, 0.97959],
        [0.20708, 0.66866, 0.97423],
        [0.20021, 0.67842, 0.96833],
        [0.19326, 0.68812, 0.96190],
        [0.18625, 0.69775, 0.95498],
        [0.17923, 0.70732, 0.94761],
        [0.17223, 0.71680, 0.93981],
        [0.16529, 0.72620, 0.93161],
        [0.15844, 0.73551, 0.92305],
        [0.15173, 0.74472, 0.91416],
        [0.14519, 0.75381, 0.90496],
        [0.13886, 0.76279, 0.89550],
        [0.13278, 0.77165, 0.88580],
        [0.12698, 0.78037, 0.87590],
        [0.12151, 0.78896, 0.86581],
        [0.11639, 0.79740, 0.85559],
        [0.11167, 0.80569, 0.84525],
        [0.10738, 0.81381, 0.83484],
        [0.10357, 0.82177, 0.82437],
        [0.10026, 0.82955, 0.81389],
        [0.09750, 0.83714, 0.80342],
        [0.09532, 0.84455, 0.79299],
        [0.09377, 0.85175, 0.78264],
        [0.09287, 0.85875, 0.77240],
        [0.09267, 0.86554, 0.76230],
        [0.09320, 0.87211, 0.75237],
        [0.09451, 0.87844, 0.74265],
        [0.09662, 0.88454, 0.73316],
        [0.09958, 0.89040, 0.72393],
        [0.10342, 0.89600, 0.71500],
        [0.10815, 0.90142, 0.70599],
        [0.11374, 0.90673, 0.69651],
        [0.12014, 0.91193, 0.68660],
        [0.12733, 0.91701, 0.67627],
        [0.13526, 0.92197, 0.66556],
        [0.14391, 0.92680, 0.65448],
        [0.15323, 0.93151, 0.64308],
        [0.16319, 0.93609, 0.63137],
        [0.17377, 0.94053, 0.61938],
        [0.18491, 0.94484, 0.60713],
        [0.19659, 0.94901, 0.59466],
        [0.20877, 0.95304, 0.58199],
        [0.22142, 0.95692, 0.56914],
        [0.23449, 0.96065, 0.55614],
        [0.24797, 0.96423, 0.54303],
        [0.26180, 0.96765, 0.52981],
        [0.27597, 0.97092, 0.51653],
        [0.29042, 0.97403, 0.50321],
        [0.30513, 0.97697, 0.48987],
        [0.32006, 0.97974, 0.47654],
        [0.33517, 0.98234, 0.46325],
        [0.35043, 0.98477, 0.45002],
        [0.36581, 0.98702, 0.43688],
        [0.38127, 0.98909, 0.42386],
        [0.39678, 0.99098, 0.41098],
        [0.41229, 0.99268, 0.39826],
        [0.42778, 0.99419, 0.38575],
        [0.44321, 0.99551, 0.37345],
        [0.45854, 0.99663, 0.36140],
        [0.47375, 0.99755, 0.34963],
        [0.48879, 0.99828, 0.33816],
        [0.50362, 0.99879, 0.32701],
        [0.51822, 0.99910, 0.31622],
        [0.53255, 0.99919, 0.30581],
        [0.54658, 0.99907, 0.29581],
        [0.56026, 0.99873, 0.28623],
        [0.57357, 0.99817, 0.27712],
        [0.58646, 0.99739, 0.26849],
        [0.59891, 0.99638, 0.26038],
        [0.61088, 0.99514, 0.25280],
        [0.62233, 0.99366, 0.24579],
        [0.63323, 0.99195, 0.23937],
        [0.64362, 0.98999, 0.23356],
        [0.65394, 0.98775, 0.22835],
        [0.66428, 0.98524, 0.22370],
        [0.67462, 0.98246, 0.21960],
        [0.68494, 0.97941, 0.21602],
        [0.69525, 0.97610, 0.21294],
        [0.70553, 0.97255, 0.21032],
        [0.71577, 0.96875, 0.20815],
        [0.72596, 0.96470, 0.20640],
        [0.73610, 0.96043, 0.20504],
        [0.74617, 0.95593, 0.20406],
        [0.75617, 0.95121, 0.20343],
        [0.76608, 0.94627, 0.20311],
        [0.77591, 0.94113, 0.20310],
        [0.78563, 0.93579, 0.20336],
        [0.79524, 0.93025, 0.20386],
        [0.80473, 0.92452, 0.20459],
        [0.81410, 0.91861, 0.20552],
        [0.82333, 0.91253, 0.20663],
        [0.83241, 0.90627, 0.20788],
        [0.84133, 0.89986, 0.20926],
        [0.85010, 0.89328, 0.21074],
        [0.85868, 0.88655, 0.21230],
        [0.86709, 0.87968, 0.21391],
        [0.87530, 0.87267, 0.21555],
        [0.88331, 0.86553, 0.21719],
        [0.89112, 0.85826, 0.21880],
        [0.89870, 0.85087, 0.22038],
        [0.90605, 0.84337, 0.22188],
        [0.91317, 0.83576, 0.22328],
        [0.92004, 0.82806, 0.22456],
        [0.92666, 0.82025, 0.22570],
        [0.93301, 0.81236, 0.22667],
        [0.93909, 0.80439, 0.22744],
        [0.94489, 0.79634, 0.22800],
        [0.95039, 0.78823, 0.22831],
        [0.95560, 0.78005, 0.22836],
        [0.96049, 0.77181, 0.22811],
        [0.96507, 0.76352, 0.22754],
        [0.96931, 0.75519, 0.22663],
        [0.97323, 0.74682, 0.22536],
        [0.97679, 0.73842, 0.22369],
        [0.98000, 0.73000, 0.22161],
        [0.98289, 0.72140, 0.21918],
        [0.98549, 0.71250, 0.21650],
        [0.98781, 0.70330, 0.21358],
        [0.98986, 0.69382, 0.21043],
        [0.99163, 0.68408, 0.20706],
        [0.99314, 0.67408, 0.20348],
        [0.99438, 0.66386, 0.19971],
        [0.99535, 0.65341, 0.19577],
        [0.99607, 0.64277, 0.19165],
        [0.99654, 0.63193, 0.18738],
        [0.99675, 0.62093, 0.18297],
        [0.99672, 0.60977, 0.17842],
        [0.99644, 0.59846, 0.17376],
        [0.99593, 0.58703, 0.16899],
        [0.99517, 0.57549, 0.16412],
        [0.99419, 0.56386, 0.15918],
        [0.99297, 0.55214, 0.15417],
        [0.99153, 0.54036, 0.14910],
        [0.98987, 0.52854, 0.14398],
        [0.98799, 0.51667, 0.13883],
        [0.98590, 0.50479, 0.13367],
        [0.98360, 0.49291, 0.12849],
        [0.98108, 0.48104, 0.12332],
        [0.97837, 0.46920, 0.11817],
        [0.97545, 0.45740, 0.11305],
        [0.97234, 0.44565, 0.10797],
        [0.96904, 0.43399, 0.10294],
        [0.96555, 0.42241, 0.09798],
        [0.96187, 0.41093, 0.09310],
        [0.95801, 0.39958, 0.08831],
        [0.95398, 0.38836, 0.08362],
        [0.94977, 0.37729, 0.07905],
        [0.94538, 0.36638, 0.07461],
        [0.94084, 0.35566, 0.07031],
        [0.93612, 0.34513, 0.06616],
        [0.93125, 0.33482, 0.06218],
        [0.92623, 0.32473, 0.05837],
        [0.92105, 0.31489, 0.05475],
        [0.91572, 0.30530, 0.05134],
        [0.91024, 0.29599, 0.04814],
        [0.90463, 0.28696, 0.04516],
        [0.89888, 0.27824, 0.04243],
        [0.89298, 0.26981, 0.03993],
        [0.88691, 0.26152, 0.03753],
        [0.88066, 0.25334, 0.03521],
        [0.87422, 0.24526, 0.03297],
        [0.86760, 0.23730, 0.03082],
        [0.86079, 0.22945, 0.02875],
        [0.85380, 0.22170, 0.02677],
        [0.84662, 0.21407, 0.02487],
        [0.83926, 0.20654, 0.02305],
        [0.83172, 0.19912, 0.02131],
        [0.82399, 0.19182, 0.01966],
        [0.81608, 0.18462, 0.01809],
        [0.80799, 0.17753, 0.01660],
        [0.79971, 0.17055, 0.01520],
        [0.79125, 0.16368, 0.01387],
        [0.78260, 0.15693, 0.01264],
        [0.77377, 0.15028, 0.01148],
        [0.76476, 0.14374, 0.01041],
        [0.75556, 0.13731, 0.00942],
        [0.74617, 0.13098, 0.00851],
        [0.73661, 0.12477, 0.00769],
        [0.72686, 0.11867, 0.00695],
        [0.71692, 0.11268, 0.00629],
        [0.70680, 0.10680, 0.00571],
        [0.69650, 0.10102, 0.00522],
        [0.68602, 0.09536, 0.00481],
        [0.67535, 0.08980, 0.00449],
        [0.66449, 0.08436, 0.00424],
        [0.65345, 0.07902, 0.00408],
        [0.64223, 0.07380, 0.00401],
        [0.63082, 0.06868, 0.00401],
        [0.61923, 0.06367, 0.00410],
        [0.60746, 0.05878, 0.00427],
        [0.59550, 0.05399, 0.00453],
        [0.58336, 0.04931, 0.00486],
        [0.57103, 0.04474, 0.00529],
        [0.55852, 0.04028, 0.00579],
        [0.54583, 0.03593, 0.00638],
        [0.53295, 0.03169, 0.00705],
        [0.51989, 0.02756, 0.00780],
        [0.50664, 0.02354, 0.00863],
        [0.49321, 0.01963, 0.00955],
        [0.47960, 0.01583, 0.01055],
    ]
    return _cmap("linear_turbo", cm_data, reverse=reverse)


def cmap_linear_parula(reverse=False):
    # Matlab color map
    # linear colormap, perceptually uniform
    cm_data = [
        [0.2081, 0.1663, 0.5292],
        [0.2116238095, 0.1897809524, 0.5776761905],
        [0.212252381, 0.2137714286, 0.6269714286],
        [0.2081, 0.2386, 0.6770857143],
        [0.1959047619, 0.2644571429, 0.7279],
        [0.1707285714, 0.2919380952, 0.779247619],
        [0.1252714286, 0.3242428571, 0.8302714286],
        [0.0591333333, 0.3598333333, 0.8683333333],
        [0.0116952381, 0.3875095238, 0.8819571429],
        [0.0059571429, 0.4086142857, 0.8828428571],
        [0.0165142857, 0.4266, 0.8786333333],
        [0.032852381, 0.4430428571, 0.8719571429],
        [0.0498142857, 0.4585714286, 0.8640571429],
        [0.0629333333, 0.4736904762, 0.8554380952],
        [0.0722666667, 0.4886666667, 0.8467],
        [0.0779428571, 0.5039857143, 0.8383714286],
        [0.079347619, 0.5200238095, 0.8311809524],
        [0.0749428571, 0.5375428571, 0.8262714286],
        [0.0640571429, 0.5569857143, 0.8239571429],
        [0.0487714286, 0.5772238095, 0.8228285714],
        [0.0343428571, 0.5965809524, 0.819852381],
        [0.0265, 0.6137, 0.8135],
        [0.0238904762, 0.6286619048, 0.8037619048],
        [0.0230904762, 0.6417857143, 0.7912666667],
        [0.0227714286, 0.6534857143, 0.7767571429],
        [0.0266619048, 0.6641952381, 0.7607190476],
        [0.0383714286, 0.6742714286, 0.743552381],
        [0.0589714286, 0.6837571429, 0.7253857143],
        [0.0843, 0.6928333333, 0.7061666667],
        [0.1132952381, 0.7015, 0.6858571429],
        [0.1452714286, 0.7097571429, 0.6646285714],
        [0.1801333333, 0.7176571429, 0.6424333333],
        [0.2178285714, 0.7250428571, 0.6192619048],
        [0.2586428571, 0.7317142857, 0.5954285714],
        [0.3021714286, 0.7376047619, 0.5711857143],
        [0.3481666667, 0.7424333333, 0.5472666667],
        [0.3952571429, 0.7459, 0.5244428571],
        [0.4420095238, 0.7480809524, 0.5033142857],
        [0.4871238095, 0.7490619048, 0.4839761905],
        [0.5300285714, 0.7491142857, 0.4661142857],
        [0.5708571429, 0.7485190476, 0.4493904762],
        [0.609852381, 0.7473142857, 0.4336857143],
        [0.6473, 0.7456, 0.4188],
        [0.6834190476, 0.7434761905, 0.4044333333],
        [0.7184095238, 0.7411333333, 0.3904761905],
        [0.7524857143, 0.7384, 0.3768142857],
        [0.7858428571, 0.7355666667, 0.3632714286],
        [0.8185047619, 0.7327333333, 0.3497904762],
        [0.8506571429, 0.7299, 0.3360285714],
        [0.8824333333, 0.7274333333, 0.3217],
        [0.9139333333, 0.7257857143, 0.3062761905],
        [0.9449571429, 0.7261142857, 0.2886428571],
        [0.9738952381, 0.7313952381, 0.266647619],
        [0.9937714286, 0.7454571429, 0.240347619],
        [0.9990428571, 0.7653142857, 0.2164142857],
        [0.9955333333, 0.7860571429, 0.196652381],
        [0.988, 0.8066, 0.1793666667],
        [0.9788571429, 0.8271428571, 0.1633142857],
        [0.9697, 0.8481380952, 0.147452381],
        [0.9625857143, 0.8705142857, 0.1309],
        [0.9588714286, 0.8949, 0.1132428571],
        [0.9598238095, 0.9218333333, 0.0948380952],
        [0.9661, 0.9514428571, 0.0755333333],
        [0.9763, 0.9831, 0.0538],
    ]
    return _cmap("linear_parula", cm_data, reverse=reverse)


def cmap_linear_haline(reverse=False):
    # cmocean, MIT license
    # linear colormap, perceptually uniform
    cm_data = [
        [0.16295295, 0.09521592, 0.42257292],
        [0.16481011, 0.09635116, 0.43184597],
        [0.16661617, 0.09744967, 0.44120648],
        [0.16836624, 0.09851521, 0.4506511],
        [0.17005471, 0.09955275, 0.46017511],
        [0.17167508, 0.10056873, 0.46977222],
        [0.17321987, 0.10157136, 0.47943423],
        [0.17468043, 0.10257097, 0.48915068],
        [0.17604337, 0.10356584, 0.4989416],
        [0.17729823, 0.10458025, 0.50877159],
        [0.1784323, 0.10563803, 0.51861083],
        [0.17942267, 0.10674166, 0.52848361],
        [0.18025423, 0.10793563, 0.53832457],
        [0.18089754, 0.10923866, 0.54813521],
        [0.18132983, 0.11070429, 0.55784354],
        [0.18150693, 0.11236134, 0.56744719],
        [0.18139596, 0.11428044, 0.57685059],
        [0.18094994, 0.11652515, 0.5859821],
        [0.18011665, 0.1191683, 0.59474942],
        [0.17884196, 0.12228861, 0.60303661],
        [0.17707513, 0.12596207, 0.61070774],
        [0.1747765, 0.13024864, 0.61761743],
        [0.17192559, 0.13517685, 0.62362908],
        [0.16853023, 0.14073088, 0.62863572],
        [0.16463735, 0.14684332, 0.63257966],
        [0.16031417, 0.15340748, 0.63547019],
        [0.15565395, 0.16029118, 0.63737422],
        [0.15073736, 0.16736889, 0.63839897],
        [0.14564276, 0.17452933, 0.63866876],
        [0.14043681, 0.18168415, 0.63830895],
        [0.13517265, 0.18876883, 0.63743501],
        [0.12989066, 0.19573986, 0.63614699],
        [0.12462051, 0.20257034, 0.63452826],
        [0.1193859, 0.20924466, 0.63264783],
        [0.11422949, 0.21574563, 0.63057687],
        [0.10914049, 0.22208312, 0.62834552],
        [0.10414386, 0.22825465, 0.62599796],
        [0.09926305, 0.23426098, 0.62357178],
        [0.09449513, 0.240114, 0.62108167],
        [0.08986952, 0.24581472, 0.61855919],
        [0.08539286, 0.25137295, 0.61601663],
        [0.08106757, 0.25679971, 0.61345967],
        [0.07694419, 0.26209156, 0.61092383],
        [0.07300704, 0.2672655, 0.6083965],
        [0.06927651, 0.2723273, 0.60588732],
        [0.06578801, 0.27727895, 0.60341418],
        [0.06255595, 0.28212824, 0.60097879],
        [0.05959205, 0.28688317, 0.59857975],
        [0.05691772, 0.29154887, 0.5962215],
        [0.05455347, 0.29613025, 0.5939076],
        [0.0525189, 0.30063184, 0.59164148],
        [0.05083877, 0.30505623, 0.58943153],
        [0.04951454, 0.30941022, 0.58727149],
        [0.0485549, 0.31369777, 0.58516273],
        [0.04796369, 0.3179226, 0.58310625],
        [0.04773946, 0.32208826, 0.58110273],
        [0.04787545, 0.32619809, 0.57915259],
        [0.04835985, 0.33025524, 0.57725602],
        [0.04917639, 0.3342627, 0.57541302],
        [0.05030519, 0.3382233, 0.57362343],
        [0.05172369, 0.34213968, 0.57188697],
        [0.05340768, 0.34601437, 0.57020322],
        [0.05533215, 0.34984975, 0.5685717],
        [0.05747218, 0.35364807, 0.56699183],
        [0.05980352, 0.35741146, 0.56546298],
        [0.06230309, 0.36114193, 0.56398445],
        [0.06494928, 0.36484141, 0.56255553],
        [0.06772215, 0.3685117, 0.56117544],
        [0.07060351, 0.37215453, 0.55984338],
        [0.0735784, 0.37577101, 0.55856129],
        [0.07663101, 0.379363, 0.55732688],
        [0.0797474, 0.38293224, 0.55613803],
        [0.08291581, 0.38648014, 0.55499386],
        [0.08612581, 0.39000807, 0.55389345],
        [0.08936818, 0.39351731, 0.55283591],
        [0.09263475, 0.39700911, 0.5518203],
        [0.09591831, 0.40048465, 0.55084572],
        [0.09921324, 0.4039447, 0.54991337],
        [0.10251396, 0.40739026, 0.54902285],
        [0.10581449, 0.41082289, 0.54817039],
        [0.10911041, 0.41424357, 0.54735502],
        [0.11239785, 0.41765327, 0.5465758],
        [0.11567334, 0.42105293, 0.54583174],
        [0.11893417, 0.42444322, 0.54512319],
        [0.12217819, 0.42782467, 0.5444513],
        [0.12540189, 0.43119871, 0.54381137],
        [0.12860313, 0.43456614, 0.54320239],
        [0.13177997, 0.43792773, 0.54262334],
        [0.1349307, 0.44128422, 0.54207318],
        [0.13805491, 0.44463569, 0.54155509],
        [0.14115011, 0.44798348, 0.54106381],
        [0.14421502, 0.45132831, 0.54059793],
        [0.14724858, 0.45467082, 0.54015636],
        [0.15024993, 0.4580116, 0.5397383],
        [0.1532192, 0.46135071, 0.53934608],
        [0.15615459, 0.46468937, 0.53897446],
        [0.15905548, 0.46802811, 0.53862227],
        [0.16192139, 0.47136748, 0.53828832],
        [0.16475245, 0.4747077, 0.53797335],
        [0.16754826, 0.47804933, 0.5376757],
        [0.17030807, 0.48139312, 0.53739229],
        [0.17303172, 0.4847395, 0.53712185],
        [0.17571937, 0.48808883, 0.53686368],
        [0.17837165, 0.49144123, 0.53661836],
        [0.18098782, 0.4947975, 0.53638175],
        [0.18356807, 0.49815802, 0.53615252],
        [0.18611271, 0.50152311, 0.53592932],
        [0.18862304, 0.50489271, 0.53571335],
        [0.19109853, 0.50826757, 0.53550031],
        [0.19353972, 0.51164795, 0.53528878],
        [0.19594729, 0.51503411, 0.53507737],
        [0.19832271, 0.51842599, 0.53486655],
        [0.20066603, 0.52182411, 0.5346528],
        [0.20297814, 0.52522869, 0.53443452],
        [0.20526004, 0.52863989, 0.53421026],
        [0.20751347, 0.53205763, 0.53398],
        [0.20973895, 0.53548228, 0.53374061],
        [0.21193777, 0.53891395, 0.53349055],
        [0.21411134, 0.54235271, 0.53322838],
        [0.21626158, 0.54579847, 0.53295358],
        [0.21838953, 0.54925145, 0.53266342],
        [0.2204969, 0.55271165, 0.53235648],
        [0.22258553, 0.55617904, 0.53203143],
        [0.22465737, 0.55965355, 0.53168703],
        [0.22671414, 0.56313522, 0.53132127],
        [0.22875792, 0.56662395, 0.53093283],
        [0.23079087, 0.57011965, 0.53052033],
        [0.23281507, 0.57362224, 0.53008206],
        [0.23483286, 0.57713158, 0.52961673],
        [0.23684665, 0.58064749, 0.52912308],
        [0.23885883, 0.58416983, 0.52859959],
        [0.24087168, 0.5876985, 0.52804439],
        [0.24288806, 0.59123319, 0.52745678],
        [0.24491068, 0.59477367, 0.52683562],
        [0.24694203, 0.59831977, 0.52617913],
        [0.24898467, 0.60187131, 0.5254855],
        [0.25104184, 0.60542788, 0.52475455],
        [0.25311648, 0.60898917, 0.5239853],
        [0.25521116, 0.61255501, 0.52317565],
        [0.25732863, 0.61612516, 0.52232392],
        [0.25947244, 0.61969909, 0.52143048],
        [0.26164566, 0.62327645, 0.52049446],
        [0.26385093, 0.62685702, 0.51951365],
        [0.26609108, 0.63044055, 0.51848614],
        [0.26836985, 0.63402641, 0.51741302],
        [0.27069035, 0.63761419, 0.51629357],
        [0.27305542, 0.64120359, 0.51512593],
        [0.27546763, 0.64479445, 0.51390698],
        [0.2779309, 0.64838599, 0.51263903],
        [0.28044833, 0.65197775, 0.51132146],
        [0.283023, 0.65556926, 0.5099537],
        [0.28565699, 0.6591606, 0.50852973],
        [0.28835435, 0.66275079, 0.50705376],
        [0.29111809, 0.66633932, 0.50552536],
        [0.29395118, 0.66992568, 0.50394405],
        [0.29685621, 0.67350965, 0.50230621],
        [0.29983621, 0.6770907, 0.50061096],
        [0.3028944, 0.68066801, 0.49886092],
        [0.30603358, 0.68424103, 0.49705572],
        [0.30925654, 0.6878092, 0.495195],
        [0.31256595, 0.69137231, 0.4932732],
        [0.31596475, 0.69492953, 0.49129275],
        [0.31945565, 0.6984801, 0.48925534],
        [0.32304124, 0.70202339, 0.48716074],
        [0.3267241, 0.70555876, 0.48500876],
        [0.33050708, 0.70908574, 0.48279556],
        [0.33439297, 0.71260364, 0.48052013],
        [0.33838396, 0.71611153, 0.47818646],
        [0.34248248, 0.71960867, 0.47579452],
        [0.34669093, 0.72309429, 0.47334431],
        [0.3510117, 0.72656762, 0.4708359],
        [0.35544775, 0.73002792, 0.46826672],
        [0.36000221, 0.73347437, 0.46563433],
        [0.36467645, 0.73690592, 0.46294413],
        [0.36947282, 0.74032165, 0.46019651],
        [0.37439369, 0.7437206, 0.45739197],
        [0.37944143, 0.74710175, 0.45453114],
        [0.38461841, 0.75046408, 0.45161478],
        [0.38992704, 0.75380647, 0.44864382],
        [0.39536975, 0.75712778, 0.44561937],
        [0.40095086, 0.76042675, 0.44253806],
        [0.4066714, 0.76370211, 0.43940565],
        [0.41253348, 0.76695254, 0.43622497],
        [0.41853957, 0.77017668, 0.43299833],
        [0.42469214, 0.77337305, 0.42972841],
        [0.43099366, 0.77654014, 0.42641835],
        [0.4374466, 0.77967637, 0.4230718],
        [0.44405337, 0.78278006, 0.41969303],
        [0.45081634, 0.78584949, 0.41628696],
        [0.45773776, 0.78888286, 0.41285929],
        [0.46481977, 0.79187831, 0.40941661],
        [0.47206428, 0.7948339, 0.4059665],
        [0.47947297, 0.79774769, 0.40251764],
        [0.4870472, 0.80061765, 0.39907996],
        [0.49478789, 0.80344179, 0.39566477],
        [0.50269545, 0.80621808, 0.39228485],
        [0.51077223, 0.80894416, 0.38895135],
        [0.51901758, 0.81161801, 0.38568043],
        [0.52742705, 0.81423825, 0.38249349],
        [0.53599744, 0.81680329, 0.37941065],
        [0.5447243, 0.8193118, 0.37645392],
        [0.55360175, 0.82176277, 0.37364707],
        [0.56262239, 0.82415554, 0.37101546],
        [0.57178017, 0.8264893, 0.36858305],
        [0.58106198, 0.82876481, 0.36637986],
        [0.59045227, 0.83098363, 0.36443634],
        [0.59993631, 0.83314747, 0.3627802],
        [0.60949784, 0.8352587, 0.36143806],
        [0.61911788, 0.83732074, 0.3604355],
        [0.62877531, 0.83933797, 0.35979568],
        [0.63845159, 0.84131462, 0.35953618],
        [0.64812757, 0.84325556, 0.35967077],
        [0.65778455, 0.84516598, 0.36020866],
        [0.66740471, 0.84705131, 0.36115427],
        [0.67696176, 0.84891984, 0.36250963],
        [0.68644876, 0.85077489, 0.36426656],
        [0.69585443, 0.85262128, 0.36641547],
        [0.70516856, 0.85446373, 0.36894368],
        [0.71438303, 0.85630656, 0.37183582],
        [0.72349176, 0.85815365, 0.3750745],
        [0.73249065, 0.86000837, 0.37864099],
        [0.74137736, 0.86187357, 0.3825159],
        [0.7501512, 0.86375161, 0.38667965],
        [0.75881284, 0.86564434, 0.39111303],
        [0.76736417, 0.8675532, 0.39579749],
        [0.77580803, 0.86947917, 0.40071548],
        [0.78414804, 0.87142291, 0.40585059],
        [0.79237773, 0.87338865, 0.41118249],
        [0.80049763, 0.87537819, 0.41669356],
        [0.80852429, 0.87738718, 0.42237605],
        [0.81646307, 0.87941518, 0.42821863],
        [0.82431945, 0.88146161, 0.43421127],
        [0.83208604, 0.88353084, 0.44033585],
        [0.83975443, 0.88562785, 0.44657232],
        [0.8473544, 0.88774214, 0.45293066],
        [0.85489132, 0.88987266, 0.45940532],
        [0.86234095, 0.89203075, 0.46596504],
        [0.86971917, 0.89421116, 0.47261258],
        [0.87704795, 0.89640559, 0.4793596],
        [0.88430614, 0.89862422, 0.48617718],
        [0.89149679, 0.90086694, 0.49305896],
        [0.89865066, 0.90312109, 0.50002982],
        [0.90573286, 0.90540326, 0.50704449],
        [0.91276817, 0.90770328, 0.51412293],
        [0.91977198, 0.91001483, 0.52127748],
        [0.92669995, 0.91235949, 0.52844799],
        [0.93360939, 0.91471118, 0.53569895],
        [0.94046103, 0.91708934, 0.5429753],
        [0.94728035, 0.91948254, 0.55030445],
        [0.95406597, 0.92189212, 0.55767999],
        [0.96080498, 0.92432523, 0.56507901],
        [0.96752874, 0.92676689, 0.57254139],
        [0.97419673, 0.92923821, 0.58000416],
        [0.9808627, 0.93171248, 0.58754258],
        [0.98746841, 0.93422029, 0.59506489],
        [0.99408058, 0.93672758, 0.60267],
    ]
    return _cmap("linear_haline", cm_data, reverse=reverse)


def cmap_linear_thermal(reverse=False):
    # cmocean, MIT license
    # linear colormap, perceptually uniform
    cm_data = [
        [0.01555601, 0.13824425, 0.20181089],
        [0.01620184, 0.14105074, 0.20897651],
        [0.01685649, 0.14382701, 0.21623868],
        [0.0175264, 0.14657173, 0.2235997],
        [0.01821872, 0.14928346, 0.23106187],
        [0.01894138, 0.15196073, 0.23862748],
        [0.01969968, 0.15460145, 0.24630497],
        [0.02050332, 0.15720378, 0.25409711],
        [0.02136721, 0.15976645, 0.26199915],
        [0.02230341, 0.16228755, 0.27001321],
        [0.0233252, 0.16476505, 0.27814139],
        [0.02444728, 0.16719678, 0.28638573],
        [0.02568582, 0.16958042, 0.29474817],
        [0.02705867, 0.1719135, 0.30323056],
        [0.02858553, 0.17419338, 0.31183463],
        [0.03028808, 0.17641726, 0.32056191],
        [0.03219022, 0.17858215, 0.32941369],
        [0.03431826, 0.18068487, 0.33839101],
        [0.03670118, 0.18272205, 0.34749451],
        [0.03937082, 0.18469014, 0.35672441],
        [0.04230474, 0.18658537, 0.36608039],
        [0.04544128, 0.1884038, 0.37556146],
        [0.04879889, 0.1901413, 0.38516584],
        [0.05238565, 0.19179358, 0.39489082],
        [0.05620897, 0.19335621, 0.40473254],
        [0.06027561, 0.19482469, 0.41468582],
        [0.06459519, 0.19618775, 0.42477146],
        [0.06917294, 0.19744583, 0.43495728],
        [0.07401398, 0.19859437, 0.44523225],
        [0.07912633, 0.19962514, 0.45559656],
        [0.08452075, 0.20052842, 0.46605087],
        [0.09019392, 0.20130794, 0.47654788],
        [0.09616431, 0.20194725, 0.48710445],
        [0.1024254, 0.20245202, 0.49766462],
        [0.10899443, 0.20280889, 0.50822709],
        [0.11585974, 0.20302735, 0.51872453],
        [0.12304243, 0.2030938, 0.52914838],
        [0.13052767, 0.20302178, 0.53942012],
        [0.13830991, 0.20281956, 0.54947678],
        [0.14637971, 0.20250018, 0.55924613],
        [0.15471863, 0.20208507, 0.56864226],
        [0.16329705, 0.20160546, 0.57756769],
        [0.17207282, 0.20110273, 0.58591838],
        [0.18099176, 0.20062705, 0.59359182],
        [0.18999022, 0.20023416, 0.60049707],
        [0.19899974, 0.19998029, 0.60656515],
        [0.20795298, 0.19991643, 0.61175706],
        [0.21678952, 0.20008303, 0.61606739],
        [0.22546043, 0.20050671, 0.61952279],
        [0.23393063, 0.2011992, 0.62217608],
        [0.24217907, 0.20215872, 0.62409793],
        [0.25019713, 0.20337273, 0.62536824],
        [0.25798611, 0.20482134, 0.62606879],
        [0.26555442, 0.20648047, 0.62627797],
        [0.27291504, 0.20832446, 0.62606758],
        [0.28008339, 0.21032792, 0.62550133],
        [0.28706751, 0.21246914, 0.624642],
        [0.29388514, 0.21472543, 0.62353802],
        [0.30055772, 0.21707565, 0.62222519],
        [0.30708438, 0.21950598, 0.6207555],
        [0.31349163, 0.22199831, 0.61914522],
        [0.31977984, 0.22454204, 0.61743434],
        [0.32596955, 0.22712412, 0.61563293],
        [0.33205791, 0.22973736, 0.61377715],
        [0.33806601, 0.23237153, 0.61186606],
        [0.34399174, 0.23502151, 0.60992807],
        [0.34984607, 0.23768089, 0.60796949],
        [0.35563846, 0.2403444, 0.60599535],
        [0.36136863, 0.24300892, 0.60402414],
        [0.36704345, 0.24567078, 0.60206076],
        [0.37267088, 0.2483267, 0.60010594],
        [0.3782548, 0.25097436, 0.59816563],
        [0.38379608, 0.25361228, 0.59624988],
        [0.38929883, 0.25623877, 0.5943618],
        [0.3947691, 0.25885207, 0.59249964],
        [0.40020989, 0.26145107, 0.59066609],
        [0.40562409, 0.26403484, 0.58886331],
        [0.41101442, 0.26660262, 0.58709291],
        [0.41638322, 0.26915383, 0.5853566],
        [0.42173132, 0.27168825, 0.58365836],
        [0.42706343, 0.27420503, 0.5819941],
        [0.43238181, 0.2767038, 0.58036393],
        [0.43768862, 0.27918426, 0.57876764],
        [0.44298597, 0.28164615, 0.5772048],
        [0.44827587, 0.28408925, 0.57567472],
        [0.45356026, 0.28651338, 0.57417648],
        [0.45884104, 0.28891838, 0.57270899],
        [0.46412001, 0.2913041, 0.57127095],
        [0.46939893, 0.29367044, 0.5698609],
        [0.47467951, 0.29601729, 0.56847725],
        [0.47996336, 0.29834456, 0.56711823],
        [0.48525207, 0.30065217, 0.56578195],
        [0.49054716, 0.30294008, 0.5644664],
        [0.49585007, 0.30520822, 0.56316946],
        [0.50116221, 0.30745656, 0.56188888],
        [0.50648491, 0.30968508, 0.56062233],
        [0.51181943, 0.31189376, 0.55936737],
        [0.51716699, 0.31408263, 0.55812148],
        [0.52252871, 0.31625172, 0.55688205],
        [0.52790567, 0.31840106, 0.55564642],
        [0.53329886, 0.32053073, 0.55441182],
        [0.5387092, 0.32264084, 0.55317546],
        [0.54413753, 0.3247315, 0.55193448],
        [0.54958461, 0.32680287, 0.55068596],
        [0.55505113, 0.32885514, 0.54942696],
        [0.56053768, 0.33088852, 0.54815451],
        [0.56604476, 0.33290327, 0.54686563],
        [0.57157236, 0.33489987, 0.54555812],
        [0.57712131, 0.33687845, 0.54422801],
        [0.58269186, 0.33883938, 0.54287227],
        [0.58828416, 0.34078308, 0.54148789],
        [0.59389827, 0.34271002, 0.54007187],
        [0.59953415, 0.34462069, 0.53862124],
        [0.60519167, 0.34651565, 0.53713308],
        [0.61087061, 0.34839552, 0.5356045],
        [0.61657065, 0.35026093, 0.53403268],
        [0.62229138, 0.3521126, 0.53241484],
        [0.62803229, 0.35395127, 0.53074831],
        [0.63379279, 0.35577776, 0.52903045],
        [0.63957219, 0.35759292, 0.52725878],
        [0.64536975, 0.35939765, 0.52543076],
        [0.6511847, 0.36119285, 0.52354391],
        [0.6570161, 0.36297956, 0.52159597],
        [0.66286293, 0.36475881, 0.51958481],
        [0.6687241, 0.36653173, 0.51750839],
        [0.67459845, 0.36829947, 0.5153648],
        [0.68048472, 0.37006325, 0.51315222],
        [0.68638162, 0.37182432, 0.51086898],
        [0.69228775, 0.37358401, 0.50851352],
        [0.69820166, 0.37534367, 0.50608439],
        [0.70412186, 0.37710473, 0.50358028],
        [0.71004688, 0.37886859, 0.50099965],
        [0.71597525, 0.3806367, 0.49834106],
        [0.72190503, 0.38241075, 0.4956041],
        [0.72783443, 0.38419239, 0.49278795],
        [0.73376164, 0.3859833, 0.4898919],
        [0.73968475, 0.38778523, 0.48691538],
        [0.7456018, 0.38960001, 0.48385794],
        [0.75151077, 0.39142951, 0.48071927],
        [0.75740957, 0.39327566, 0.47749914],
        [0.76329604, 0.39514048, 0.4741975],
        [0.76916794, 0.39702603, 0.47081439],
        [0.77502298, 0.39893446, 0.46735],
        [0.78085877, 0.400868, 0.46380463],
        [0.78667286, 0.40282892, 0.46017874],
        [0.79246271, 0.4048196, 0.45647292],
        [0.79822569, 0.40684249, 0.45268792],
        [0.80395908, 0.40890011, 0.44882462],
        [0.80966007, 0.41099506, 0.44488409],
        [0.81532584, 0.41313001, 0.4408672],
        [0.82095338, 0.41530771, 0.43677537],
        [0.82653946, 0.41753108, 0.43261066],
        [0.83208085, 0.41980305, 0.42837489],
        [0.83757423, 0.42212661, 0.42407011],
        [0.84301618, 0.42450482, 0.4196986],
        [0.84840316, 0.42694082, 0.41526288],
        [0.85373155, 0.4294378, 0.41076573],
        [0.8589976, 0.43199897, 0.40621024],
        [0.8641975, 0.4346276, 0.40159975],
        [0.86932733, 0.43732696, 0.39693796],
        [0.87438311, 0.44010033, 0.39222887],
        [0.87936081, 0.44295096, 0.38747682],
        [0.88425632, 0.44588207, 0.38268654],
        [0.88906554, 0.44889681, 0.37786308],
        [0.89378437, 0.45199824, 0.3730116],
        [0.89840867, 0.45518929, 0.36813827],
        [0.90293439, 0.45847274, 0.36324942],
        [0.90735756, 0.46185117, 0.35835166],
        [0.91167433, 0.46532694, 0.35345197],
        [0.915881, 0.46890217, 0.34855767],
        [0.91997406, 0.47257868, 0.34367638],
        [0.92395023, 0.47635796, 0.33881601],
        [0.92780648, 0.48024117, 0.33398471],
        [0.93154008, 0.48422909, 0.3291908],
        [0.93514863, 0.48832213, 0.32444275],
        [0.93863008, 0.49252027, 0.31974912],
        [0.94198274, 0.49682311, 0.31511847],
        [0.94520535, 0.50122981, 0.31055931],
        [0.94829701, 0.50573917, 0.30608003],
        [0.95125725, 0.51034957, 0.30168887],
        [0.954086, 0.51505906, 0.29739377],
        [0.95678355, 0.51986536, 0.2932024],
        [0.95935057, 0.52476587, 0.28912206],
        [0.96178805, 0.52975777, 0.28515964],
        [0.9640973, 0.53483802, 0.28132156],
        [0.96627986, 0.54000343, 0.27761379],
        [0.9683375, 0.5452507, 0.27404177],
        [0.97027215, 0.55057645, 0.27061043],
        [0.97208896, 0.55597442, 0.26733231],
        [0.97378824, 0.56144311, 0.26420514],
        [0.97537225, 0.56697917, 0.2612321],
        [0.97684333, 0.5725793, 0.2584161],
        [0.97820376, 0.57824032, 0.25575953],
        [0.9794557, 0.58395922, 0.25326432],
        [0.9806012, 0.58973318, 0.25093197],
        [0.98164451, 0.59555764, 0.24876746],
        [0.9825958, 0.60142353, 0.24678389],
        [0.98344841, 0.60733543, 0.24496692],
        [0.98420378, 0.61329131, 0.24331643],
        [0.98486309, 0.61928934, 0.24183204],
        [0.98543359, 0.62532321, 0.24052074],
        [0.98592661, 0.63138392, 0.2393925],
        [0.98632908, 0.63748058, 0.2384285],
        [0.98664126, 0.64361223, 0.23762727],
        [0.9868743, 0.64977022, 0.23699778],
        [0.98703872, 0.65594684, 0.236546],
        [0.98711602, 0.66215449, 0.23625164],
        [0.98710548, 0.66839291, 0.23611251],
        [0.98704522, 0.67463615, 0.23615516],
        [0.98690081, 0.68090692, 0.23634896],
        [0.98666929, 0.68720645, 0.23669008],
        [0.98639295, 0.6935072, 0.23720252],
        [0.98603581, 0.69983201, 0.23785913],
        [0.98559369, 0.70618283, 0.23865535],
        [0.98511668, 0.71252856, 0.23961378],
        [0.98455154, 0.71890163, 0.24070275],
        [0.98392192, 0.72528731, 0.2419305],
        [0.98324116, 0.73167761, 0.24329811],
        [0.98246864, 0.738096, 0.2447854],
        [0.98166755, 0.74450581, 0.24641186],
        [0.98078113, 0.75093941, 0.24815276],
        [0.97983772, 0.75738047, 0.25001371],
        [0.97883927, 0.7638279, 0.25199054],
        [0.97775747, 0.7702969, 0.25407166],
        [0.97664794, 0.77675738, 0.25626641],
        [0.9754357, 0.78324913, 0.25855344],
        [0.9742107, 0.7897247, 0.26094721],
        [0.97288357, 0.79623051, 0.2634262],
        [0.97152974, 0.80272764, 0.26599948],
        [0.97008613, 0.80924798, 0.2686529],
        [0.96860571, 0.81576486, 0.27138993],
        [0.96704307, 0.82230061, 0.27420073],
        [0.96543772, 0.82883583, 0.27708584],
        [0.96375242, 0.83538829, 0.28003763],
        [0.96202315, 0.84194079, 0.28305544],
        [0.96021049, 0.84851164, 0.28613254],
        [0.95835763, 0.85508072, 0.28926815],
        [0.95641175, 0.86167196, 0.29245571],
        [0.95443484, 0.8682573, 0.29569479],
        [0.95234871, 0.87487125, 0.29897882],
        [0.95024646, 0.88147281, 0.30230776],
        [0.94801413, 0.88811109, 0.3056752],
        [0.94578198, 0.89473018, 0.30908112],
        [0.94341986, 0.90138491, 0.31252002],
        [0.94102862, 0.90803285, 0.31599064],
        [0.93853313, 0.91470475, 0.31948933],
        [0.93597111, 0.92138481, 0.32301384],
        [0.9333376, 0.92807483, 0.32656155],
        [0.93059157, 0.93479051, 0.33012998],
        [0.92781425, 0.94149986, 0.33371683],
        [0.92488992, 0.94824702, 0.33731997],
        [0.92194114, 0.95498491, 0.34093705],
        [0.91886139, 0.96175325, 0.3445663],
        [0.91569318, 0.96853549, 0.34820569],
        [0.91244907, 0.97532669, 0.35185336],
        [0.90904184, 0.98215741, 0.35550781],
    ]
    return _cmap("linear_thermal", cm_data, reverse=reverse)


def cmap_linear_deep(reverse=False):
    # cmocean, MIT license
    # linear colormap, perceptually uniform
    cm_data = [
        [0.15610197, 0.10260825, 0.17272157],
        [0.15879951, 0.10562813, 0.17808215],
        [0.16148781, 0.10863318, 0.18344165],
        [0.16415718, 0.11162318, 0.18883992],
        [0.16681176, 0.11459941, 0.19425947],
        [0.16945091, 0.11756264, 0.19970233],
        [0.17207033, 0.12051292, 0.20518607],
        [0.17467698, 0.12345223, 0.21067979],
        [0.17725957, 0.12637929, 0.21623094],
        [0.17983088, 0.12929727, 0.22178284],
        [0.18237518, 0.13220381, 0.2274021],
        [0.18490718, 0.13510267, 0.23302318],
        [0.18741252, 0.13799155, 0.23870629],
        [0.18990318, 0.1408738, 0.24439758],
        [0.19236658, 0.14374739, 0.25014898],
        [0.19481375, 0.14661556, 0.2559107],
        [0.19723196, 0.14947616, 0.26173441],
        [0.19963336, 0.15233276, 0.26756593],
        [0.20200284, 0.15518269, 0.2734655],
        [0.20435511, 0.15803011, 0.27936892],
        [0.20667286, 0.16087193, 0.28534375],
        [0.20897027, 0.16371219, 0.29132868],
        [0.21123508, 0.16654905, 0.29736908],
        [0.21347308, 0.16938469, 0.30343772],
        [0.21568192, 0.17221954, 0.30953956],
        [0.21785541, 0.17505333, 0.31569323],
        [0.22000279, 0.17788891, 0.32185935],
        [0.22210836, 0.18072434, 0.32809006],
        [0.22418213, 0.18356266, 0.33434315],
        [0.2262221, 0.18640462, 0.34062032],
        [0.22821552, 0.18924937, 0.34695853],
        [0.23017343, 0.19210006, 0.35331317],
        [0.23209137, 0.19495728, 0.35969247],
        [0.23395668, 0.19782084, 0.36612828],
        [0.23577916, 0.20069365, 0.37258104],
        [0.23755595, 0.2035769, 0.3790513],
        [0.23927601, 0.20647121, 0.38556163],
        [0.24093942, 0.20937861, 0.39210045],
        [0.24254746, 0.21230118, 0.39865318],
        [0.2440963, 0.21524071, 0.40521875],
        [0.2455818, 0.21819916, 0.41179552],
        [0.24699281, 0.22117861, 0.41839657],
        [0.24833066, 0.22418177, 0.42500332],
        [0.24959215, 0.22721132, 0.43160747],
        [0.25077214, 0.23027012, 0.43820368],
        [0.25186528, 0.23336132, 0.44478539],
        [0.252866, 0.23648829, 0.45134461],
        [0.25376865, 0.23965469, 0.45787181],
        [0.25456757, 0.24286438, 0.46435576],
        [0.25525721, 0.24612144, 0.47078343],
        [0.25583228, 0.24943005, 0.47713997],
        [0.25628796, 0.25279443, 0.48340873],
        [0.25661512, 0.25621955, 0.48957708],
        [0.25680888, 0.25970984, 0.49562536],
        [0.25687291, 0.26326808, 0.50152514],
        [0.25680712, 0.26689714, 0.50725418],
        [0.25660517, 0.27060089, 0.51279636],
        [0.25627372, 0.27437999, 0.51812616],
        [0.2558254, 0.27823281, 0.523219],
        [0.25525973, 0.28216003, 0.5280624],
        [0.25459786, 0.28615608, 0.53263702],
        [0.25385147, 0.29021676, 0.53693454],
        [0.25303784, 0.29433557, 0.54094998],
        [0.25217537, 0.29850489, 0.54468392],
        [0.25128177, 0.30271674, 0.54814227],
        [0.25037292, 0.30696328, 0.55133524],
        [0.24946824, 0.31123536, 0.55427663],
        [0.24857612, 0.31552728, 0.55698221],
        [0.2477157, 0.31982991, 0.55947045],
        [0.24689121, 0.3241392, 0.56175861],
        [0.24611215, 0.32844959, 0.56386485],
        [0.24538978, 0.33275513, 0.56580822],
        [0.24472203, 0.33705469, 0.56760298],
        [0.24411647, 0.3413441, 0.56926586],
        [0.24357904, 0.34561997, 0.57081275],
        [0.24310562, 0.34988262, 0.57225403],
        [0.24269783, 0.35413056, 0.5736016],
        [0.24236192, 0.35836085, 0.57486937],
        [0.2420947, 0.36257399, 0.5760654],
        [0.24189401, 0.36677027, 0.57719727],
        [0.24175956, 0.37094938, 0.57827294],
        [0.24169076, 0.37511123, 0.57929958],
        [0.2416897, 0.37925483, 0.58028581],
        [0.24175313, 0.38338117, 0.58123598],
        [0.24187844, 0.387491, 0.58215425],
        [0.24206427, 0.39158472, 0.58304526],
        [0.24230913, 0.39566275, 0.58391314],
        [0.24261144, 0.39972561, 0.5847616],
        [0.24296954, 0.40377384, 0.58559395],
        [0.24338171, 0.40780801, 0.58641316],
        [0.24384618, 0.41182872, 0.58722185],
        [0.24436114, 0.4158366, 0.58802239],
        [0.24492561, 0.41983198, 0.58881765],
        [0.24553674, 0.42381585, 0.58960858],
        [0.24619263, 0.42778886, 0.59039677],
        [0.24689148, 0.43175165, 0.59118371],
        [0.24763144, 0.43570484, 0.59197068],
        [0.24841072, 0.43964906, 0.59275883],
        [0.24922752, 0.44358493, 0.59354913],
        [0.25008005, 0.44751306, 0.59434245],
        [0.25096657, 0.45143404, 0.59513951],
        [0.25188534, 0.45534848, 0.59594094],
        [0.25283469, 0.45925694, 0.59674727],
        [0.25381294, 0.46316, 0.5975589],
        [0.25481847, 0.46705822, 0.59837617],
        [0.25584972, 0.47095213, 0.59919934],
        [0.25690514, 0.47484228, 0.60002857],
        [0.25798324, 0.47872916, 0.60086398],
        [0.25908258, 0.4826133, 0.60170558],
        [0.26020178, 0.48649518, 0.60255336],
        [0.2613397, 0.4903752, 0.60340742],
        [0.26249484, 0.4942539, 0.60426741],
        [0.26366598, 0.49813174, 0.6051331],
        [0.26485195, 0.50200914, 0.60600423],
        [0.26605166, 0.50588653, 0.6068805],
        [0.26726407, 0.5097643, 0.60776157],
        [0.26848824, 0.51364284, 0.60864705],
        [0.26972326, 0.51752253, 0.60953651],
        [0.27096833, 0.52140372, 0.61042947],
        [0.27222271, 0.52528675, 0.61132543],
        [0.27348573, 0.52917194, 0.61222386],
        [0.27475681, 0.53305961, 0.61312416],
        [0.27603547, 0.53695005, 0.61402574],
        [0.27732128, 0.54084353, 0.61492795],
        [0.27861393, 0.5447403, 0.61583014],
        [0.27991319, 0.54864062, 0.61673159],
        [0.28121892, 0.5525447, 0.6176316],
        [0.28253107, 0.55645275, 0.61852942],
        [0.28384971, 0.56036495, 0.61942427],
        [0.28517499, 0.56428149, 0.62031537],
        [0.28650717, 0.56820249, 0.62120191],
        [0.28784651, 0.57212815, 0.62208291],
        [0.28919353, 0.57605855, 0.62295759],
        [0.29054888, 0.57999377, 0.62382514],
        [0.29191327, 0.58393389, 0.62468468],
        [0.29328753, 0.58787895, 0.62553534],
        [0.29467261, 0.59182898, 0.62637622],
        [0.29606961, 0.59578401, 0.6272064],
        [0.29747971, 0.599744, 0.62802499],
        [0.29890426, 0.60370894, 0.62883105],
        [0.30034472, 0.60767877, 0.62962366],
        [0.3018027, 0.6116534, 0.6304019],
        [0.30327995, 0.61563273, 0.63116484],
        [0.30477834, 0.61961664, 0.63191155],
        [0.30629992, 0.62360498, 0.63264111],
        [0.30784684, 0.62759757, 0.63335259],
        [0.30942143, 0.63159422, 0.63404509],
        [0.31102618, 0.63559469, 0.63471769],
        [0.31266369, 0.63959874, 0.6353695],
        [0.31433675, 0.64360608, 0.63599965],
        [0.31604829, 0.6476164, 0.63660727],
        [0.31780141, 0.65162937, 0.63719152],
        [0.31959934, 0.65564462, 0.63775156],
        [0.32144548, 0.65966175, 0.6382866],
        [0.32334339, 0.66368034, 0.63879587],
        [0.32529678, 0.66769992, 0.63927863],
        [0.32730951, 0.67171999, 0.63973418],
        [0.32938557, 0.67574005, 0.64016185],
        [0.33152913, 0.67975951, 0.64056102],
        [0.33374413, 0.68377791, 0.6409304],
        [0.3360351, 0.68779458, 0.6412696],
        [0.33840684, 0.69180878, 0.64157857],
        [0.34086403, 0.69581978, 0.64185693],
        [0.34341147, 0.69982684, 0.64210435],
        [0.34605405, 0.70382918, 0.64232058],
        [0.34879674, 0.70782594, 0.64250547],
        [0.3516446, 0.71181627, 0.64265896],
        [0.35460272, 0.71579925, 0.64278108],
        [0.35767625, 0.71977391, 0.64287199],
        [0.36086992, 0.72373958, 0.64292927],
        [0.36418945, 0.7276949, 0.64295573],
        [0.36763999, 0.73163877, 0.64295205],
        [0.37122661, 0.73557007, 0.64291896],
        [0.37495428, 0.73948763, 0.64285736],
        [0.37882784, 0.74339025, 0.64276831],
        [0.38285235, 0.74727697, 0.64264931],
        [0.38703226, 0.75114621, 0.64250555],
        [0.39137183, 0.75499667, 0.64233873],
        [0.39587503, 0.75882703, 0.64215083],
        [0.40054593, 0.76263603, 0.64194247],
        [0.40538835, 0.76642231, 0.64171516],
        [0.41040452, 0.77018443, 0.64147423],
        [0.41559684, 0.77392103, 0.64122273],
        [0.42096796, 0.77763083, 0.64096223],
        [0.42651956, 0.78131247, 0.64069607],
        [0.43225139, 0.78496472, 0.64043042],
        [0.43816347, 0.78858638, 0.64016943],
        [0.44425693, 0.79217623, 0.63991482],
        [0.45052876, 0.79573333, 0.63967426],
        [0.45697666, 0.79925675, 0.63945293],
        [0.46359865, 0.80274561, 0.63925487],
        [0.47039042, 0.80619928, 0.63908644],
        [0.47734697, 0.80961729, 0.63895382],
        [0.48446331, 0.81299926, 0.63886245],
        [0.49173307, 0.81634505, 0.63881848],
        [0.49914951, 0.81965467, 0.63882777],
        [0.50670501, 0.82292834, 0.63889632],
        [0.51439085, 0.82616658, 0.63903043],
        [0.52219973, 0.82936979, 0.63923462],
        [0.53012282, 0.83253876, 0.63951422],
        [0.53814812, 0.83567489, 0.63987637],
        [0.54626958, 0.83877878, 0.64032322],
        [0.55447837, 0.84185159, 0.6408588],
        [0.56276148, 0.84489535, 0.64148939],
        [0.57111152, 0.84791128, 0.64221712],
        [0.57952181, 0.85090053, 0.64304356],
        [0.5879841, 0.85386466, 0.64397109],
        [0.59648484, 0.85680645, 0.64500466],
        [0.60501947, 0.85972701, 0.64614391],
        [0.61358282, 0.86262763, 0.64738888],
        [0.62216818, 0.86550998, 0.64874031],
        [0.63076931, 0.86837576, 0.65019861],
        [0.6393757, 0.87122773, 0.65176583],
        [0.64798434, 0.87406707, 0.65344053],
        [0.65659293, 0.87689477, 0.65522105],
        [0.6651972, 0.87971238, 0.65710661],
        [0.67379331, 0.88252137, 0.65909617],
        [0.68237784, 0.88532317, 0.66118854],
        [0.69094781, 0.88811911, 0.66338232],
        [0.69950063, 0.8909105, 0.66567599],
        [0.70803409, 0.89369855, 0.66806789],
        [0.71654633, 0.8964844, 0.67055629],
        [0.72503584, 0.89926913, 0.67313935],
        [0.7335014, 0.90205374, 0.6758152],
        [0.7419421, 0.90483916, 0.6785819],
        [0.75035729, 0.90762623, 0.68143751],
        [0.75874656, 0.91041576, 0.68438007],
        [0.76710972, 0.91320846, 0.68740763],
        [0.77544679, 0.91600497, 0.69051825],
        [0.78375799, 0.91880591, 0.69371001],
        [0.79204369, 0.92161178, 0.69698104],
        [0.8003044, 0.92442306, 0.70032949],
        [0.80854079, 0.92724016, 0.70375359],
        [0.81675365, 0.93006344, 0.7072516],
        [0.82494386, 0.93289321, 0.71082186],
        [0.83310566, 0.93573198, 0.71446311],
        [0.84124229, 0.9385793, 0.71817346],
        [0.84935864, 0.94143411, 0.72195118],
        [0.85745594, 0.94429655, 0.72579485],
        [0.8655355, 0.94716668, 0.72970312],
        [0.87359867, 0.95004456, 0.73367476],
        [0.8816326, 0.95293526, 0.73770822],
        [0.88965121, 0.95583441, 0.74180237],
        [0.89765699, 0.95874159, 0.7459562],
        [0.90565146, 0.96165671, 0.7501688],
        [0.9136274, 0.96458287, 0.75443868],
        [0.92158503, 0.96752052, 0.75876468],
        [0.92953534, 0.97046601, 0.76314675],
        [0.93747992, 0.97341911, 0.76758435],
        [0.94540698, 0.97638475, 0.77207538],
        [0.95332337, 0.97936076, 0.77661978],
        [0.96123821, 0.98234397, 0.78121815],
        [0.96914884, 0.98533575, 0.78586971],
        [0.97704185, 0.98834183, 0.79057175],
        [0.98493745, 0.99135452, 0.79532716],
        [0.99283718, 0.99437346, 0.8001362],
    ]
    return _cmap("linear_deep", cm_data, reverse=reverse)


def cmap_cyclic_phase(reverse=False):
    # cmocean, MIT license
    # cyclic colormap, perceptually uniform
    cm_data = [
        [0.65830839, 0.46993917, 0.04941288],
        [0.66433742, 0.4662019, 0.05766473],
        [0.67020869, 0.46248014, 0.0653456],
        [0.67604299, 0.45869838, 0.07273174],
        [0.68175228, 0.45491407, 0.07979262],
        [0.6874028, 0.45108417, 0.08667103],
        [0.6929505, 0.44723893, 0.09335869],
        [0.69842619, 0.44335768, 0.09992839],
        [0.7038123, 0.43945328, 0.1063871],
        [0.70912069, 0.43551765, 0.11277174],
        [0.71434524, 0.43155576, 0.11909348],
        [0.71949289, 0.42756272, 0.12537606],
        [0.72455619, 0.4235447, 0.13162325],
        [0.72954895, 0.41949098, 0.13786305],
        [0.73445172, 0.41541774, 0.14408039],
        [0.73929496, 0.41129973, 0.15032217],
        [0.74403834, 0.40717158, 0.15654335],
        [0.74873695, 0.40298519, 0.16282282],
        [0.75332319, 0.39880107, 0.16907566],
        [0.75788083, 0.39454245, 0.17542179],
        [0.7623326, 0.39028096, 0.18175915],
        [0.76673205, 0.38596549, 0.18816819],
        [0.77105247, 0.38162141, 0.19461532],
        [0.77529528, 0.37724732, 0.20110652],
        [0.77948666, 0.37281509, 0.2076873],
        [0.78358534, 0.36836772, 0.21429736],
        [0.78763763, 0.363854, 0.22101648],
        [0.79161134, 0.35930804, 0.2277974],
        [0.79550606, 0.3547299, 0.23464353],
        [0.79935398, 0.35007959, 0.24161832],
        [0.80311671, 0.34540152, 0.24865892],
        [0.80681033, 0.34067452, 0.25580075],
        [0.8104452, 0.33588248, 0.26307222],
        [0.8139968, 0.33105538, 0.27043183],
        [0.81747689, 0.32617526, 0.27791096],
        [0.82089415, 0.32122629, 0.28553846],
        [0.82422713, 0.3162362, 0.29327617],
        [0.82747661, 0.31120154, 0.30113388],
        [0.83066399, 0.30608459, 0.30917579],
        [0.83376307, 0.30092244, 0.31734921],
        [0.83677286, 0.29571346, 0.32566199],
        [0.83969693, 0.29044723, 0.33413665],
        [0.84253873, 0.28511151, 0.34279962],
        [0.84528297, 0.27972917, 0.35162078],
        [0.84792704, 0.27430045, 0.36060681],
        [0.85046793, 0.26882624, 0.36976395],
        [0.85291056, 0.26328859, 0.37913116],
        [0.855242, 0.25770888, 0.38868217],
        [0.85745673, 0.25209367, 0.39841601],
        [0.85955023, 0.24644737, 0.40833625],
        [0.86151767, 0.24077563, 0.41844557],
        [0.86335392, 0.23508521, 0.42874606],
        [0.86505685, 0.22937288, 0.43926008],
        [0.86661606, 0.22366308, 0.44996127],
        [0.86802578, 0.21796785, 0.46084758],
        [0.86928003, 0.21230132, 0.47191554],
        [0.87037274, 0.20667988, 0.48316015],
        [0.87129781, 0.2011224, 0.49457479],
        [0.87204914, 0.19565041, 0.50615118],
        [0.87262076, 0.19028829, 0.51787932],
        [0.87300686, 0.18506334, 0.5297475],
        [0.8732019, 0.18000588, 0.54174232],
        [0.87320066, 0.1751492, 0.55384874],
        [0.87299833, 0.17052942, 0.56605016],
        [0.87259058, 0.16618514, 0.57832856],
        [0.87197361, 0.16215698, 0.59066466],
        [0.87114414, 0.15848667, 0.60303881],
        [0.87009966, 0.15521687, 0.61542844],
        [0.86883823, 0.15238892, 0.62781175],
        [0.86735858, 0.15004199, 0.64016651],
        [0.8656601, 0.14821149, 0.65247022],
        [0.86374282, 0.14692762, 0.66470043],
        [0.86160744, 0.14621386, 0.67683495],
        [0.85925523, 0.14608582, 0.68885204],
        [0.85668805, 0.14655046, 0.70073065],
        [0.85390829, 0.14760576, 0.71245054],
        [0.85091881, 0.14924094, 0.7239925],
        [0.84772287, 0.15143717, 0.73533849],
        [0.84432409, 0.15416865, 0.74647174],
        [0.84072639, 0.15740403, 0.75737678],
        [0.83693394, 0.16110786, 0.76803952],
        [0.83295108, 0.16524205, 0.77844723],
        [0.82878232, 0.16976729, 0.78858858],
        [0.82443225, 0.17464414, 0.7984536],
        [0.81990551, 0.179834, 0.80803365],
        [0.81520674, 0.18529984, 0.8173214],
        [0.81034059, 0.19100664, 0.82631073],
        [0.80531176, 0.1969216, 0.83499645],
        [0.80012467, 0.20301465, 0.84337486],
        [0.79478367, 0.20925826, 0.8514432],
        [0.78929302, 0.21562737, 0.85919957],
        [0.78365681, 0.22209936, 0.86664294],
        [0.77787898, 0.22865386, 0.87377308],
        [0.7719633, 0.23527265, 0.88059043],
        [0.76591335, 0.24193947, 0.88709606],
        [0.7597325, 0.24863985, 0.89329158],
        [0.75342394, 0.25536094, 0.89917908],
        [0.74699063, 0.26209137, 0.90476105],
        [0.74043533, 0.2688211, 0.91004033],
        [0.73376055, 0.27554128, 0.91502],
        [0.72696862, 0.28224415, 0.91970339],
        [0.7200616, 0.2889229, 0.92409395],
        [0.71304134, 0.29557159, 0.92819525],
        [0.70590945, 0.30218508, 0.9320109],
        [0.69866732, 0.30875887, 0.93554451],
        [0.69131609, 0.31528914, 0.93879964],
        [0.68385669, 0.32177259, 0.94177976],
        [0.6762898, 0.32820641, 0.94448822],
        [0.6686159, 0.33458824, 0.94692818],
        [0.66083524, 0.3409161, 0.94910264],
        [0.65294785, 0.34718834, 0.95101432],
        [0.64495358, 0.35340362, 0.95266571],
        [0.63685208, 0.35956083, 0.954059],
        [0.62864284, 0.3656591, 0.95519608],
        [0.62032517, 0.3716977, 0.95607853],
        [0.61189825, 0.37767607, 0.95670757],
        [0.60336117, 0.38359374, 0.95708408],
        [0.59471291, 0.3894503, 0.95720861],
        [0.58595242, 0.39524541, 0.95708134],
        [0.5770786, 0.40097871, 0.95670212],
        [0.56809041, 0.40664983, 0.95607045],
        [0.55898686, 0.41225834, 0.95518556],
        [0.54976709, 0.41780374, 0.95404636],
        [0.5404304, 0.42328541, 0.95265153],
        [0.53097635, 0.42870263, 0.95099953],
        [0.52140479, 0.43405447, 0.94908866],
        [0.51171597, 0.43933988, 0.94691713],
        [0.50191056, 0.44455757, 0.94448311],
        [0.49198981, 0.44970607, 0.94178481],
        [0.48195555, 0.45478367, 0.93882055],
        [0.47181035, 0.45978843, 0.93558888],
        [0.46155756, 0.46471821, 0.93208866],
        [0.45119801, 0.46957218, 0.92831786],
        [0.44073852, 0.47434688, 0.92427669],
        [0.43018722, 0.47903864, 0.9199662],
        [0.41955166, 0.4836444, 0.91538759],
        [0.40884063, 0.48816094, 0.91054293],
        [0.39806421, 0.49258494, 0.90543523],
        [0.38723377, 0.49691301, 0.90006852],
        [0.37636206, 0.50114173, 0.89444794],
        [0.36546127, 0.5052684, 0.88857877],
        [0.35454654, 0.5092898, 0.88246819],
        [0.34363779, 0.51320158, 0.87612664],
        [0.33275309, 0.51700082, 0.86956409],
        [0.32191166, 0.52068487, 0.86279166],
        [0.31113372, 0.52425144, 0.85582152],
        [0.3004404, 0.52769862, 0.84866679],
        [0.28985326, 0.53102505, 0.84134123],
        [0.27939616, 0.53422931, 0.83386051],
        [0.26909181, 0.53731099, 0.82623984],
        [0.258963, 0.5402702, 0.81849475],
        [0.24903239, 0.54310763, 0.8106409],
        [0.23932229, 0.54582448, 0.80269392],
        [0.22985664, 0.54842189, 0.79467122],
        [0.2206551, 0.55090241, 0.78658706],
        [0.21173641, 0.55326901, 0.77845533],
        [0.20311843, 0.55552489, 0.77028973],
        [0.1948172, 0.55767365, 0.76210318],
        [0.1868466, 0.55971922, 0.75390763],
        [0.17921799, 0.56166586, 0.74571407],
        [0.1719422, 0.56351747, 0.73753498],
        [0.16502295, 0.56527915, 0.72937754],
        [0.15846116, 0.566956, 0.72124819],
        [0.15225499, 0.56855297, 0.71315321],
        [0.14639876, 0.57007506, 0.70509769],
        [0.14088284, 0.57152729, 0.69708554],
        [0.13569366, 0.57291467, 0.68911948],
        [0.13081385, 0.57424211, 0.68120108],
        [0.12622247, 0.57551447, 0.67333078],
        [0.12189539, 0.57673644, 0.66550792],
        [0.11780654, 0.57791235, 0.65773233],
        [0.11392613, 0.5790468, 0.64999984],
        [0.11022348, 0.58014398, 0.64230637],
        [0.10666732, 0.58120782, 0.63464733],
        [0.10322631, 0.58224198, 0.62701729],
        [0.0998697, 0.58324982, 0.61941001],
        [0.09656813, 0.58423445, 0.61181853],
        [0.09329429, 0.58519864, 0.60423523],
        [0.09002364, 0.58614483, 0.5966519],
        [0.08673514, 0.58707512, 0.58905979],
        [0.08341199, 0.58799127, 0.58144971],
        [0.08004245, 0.58889466, 0.57381211],
        [0.07662083, 0.58978633, 0.56613714],
        [0.07314852, 0.59066692, 0.55841474],
        [0.06963541, 0.5915367, 0.55063471],
        [0.06610144, 0.59239556, 0.54278681],
        [0.06257861, 0.59324304, 0.53486082],
        [0.05911304, 0.59407833, 0.52684614],
        [0.05576765, 0.5949003, 0.5187322],
        [0.05262511, 0.59570732, 0.51050978],
        [0.04978881, 0.5964975, 0.50216936],
        [0.04738319, 0.59726862, 0.49370174],
        [0.04555067, 0.59801813, 0.48509809],
        [0.04444396, 0.59874316, 0.47635],
        [0.04421323, 0.59944056, 0.46744951],
        [0.04498918, 0.60010687, 0.45838913],
        [0.04686604, 0.60073837, 0.44916187],
        [0.04988979, 0.60133103, 0.43976125],
        [0.05405573, 0.60188055, 0.4301812],
        [0.05932209, 0.60238289, 0.42040543],
        [0.06560774, 0.60283258, 0.41043772],
        [0.07281962, 0.60322442, 0.40027363],
        [0.08086177, 0.60355283, 0.38990941],
        [0.08964366, 0.60381194, 0.37934208],
        [0.09908952, 0.60399554, 0.36856412],
        [0.10914617, 0.60409695, 0.35755799],
        [0.11974119, 0.60410858, 0.34634096],
        [0.13082746, 0.6040228, 0.33491416],
        [0.14238003, 0.60383119, 0.323267],
        [0.1543847, 0.60352425, 0.31138823],
        [0.16679093, 0.60309301, 0.29931029],
        [0.17959757, 0.60252668, 0.2870237],
        [0.19279966, 0.60181364, 0.27452964],
        [0.20634465, 0.60094466, 0.2618794],
        [0.22027287, 0.5999043, 0.24904251],
        [0.23449833, 0.59868591, 0.23611022],
        [0.24904416, 0.5972746, 0.2230778],
        [0.26382006, 0.59566656, 0.21004673],
        [0.2788104, 0.5938521, 0.19705484],
        [0.29391494, 0.59183348, 0.18421621],
        [0.3090634, 0.58961302, 0.17161942],
        [0.32415577, 0.58720132, 0.15937753],
        [0.3391059, 0.58461164, 0.14759012],
        [0.35379624, 0.58186793, 0.13637734],
        [0.36817905, 0.5789861, 0.12580054],
        [0.38215966, 0.57599512, 0.1159504],
        [0.39572824, 0.57290928, 0.10685038],
        [0.40881926, 0.56975727, 0.09855521],
        [0.42148106, 0.56654159, 0.09104002],
        [0.43364953, 0.56329296, 0.08434116],
        [0.44538908, 0.56000859, 0.07841305],
        [0.45672421, 0.5566943, 0.07322913],
        [0.46765017, 0.55336373, 0.06876762],
        [0.47819138, 0.5500213, 0.06498436],
        [0.48839686, 0.54666195, 0.06182163],
        [0.49828924, 0.5432874, 0.05922726],
        [0.50789114, 0.53989827, 0.05714466],
        [0.51722475, 0.53649429, 0.05551476],
        [0.5263115, 0.53307443, 0.05427793],
        [0.53517186, 0.52963707, 0.05337567],
        [0.54382515, 0.52618009, 0.05275208],
        [0.55228947, 0.52270103, 0.05235479],
        [0.56058163, 0.51919713, 0.0521356],
        [0.56871719, 0.51566545, 0.05205062],
        [0.57671045, 0.51210292, 0.0520602],
        [0.5845745, 0.50850636, 0.05212851],
        [0.59232129, 0.50487256, 0.05222299],
        [0.5999617, 0.50119827, 0.05231367],
        [0.60750568, 0.49748022, 0.05237234],
        [0.61496232, 0.49371512, 0.05237168],
        [0.62233999, 0.48989963, 0.05228423],
        [0.62964652, 0.48603032, 0.05208127],
        [0.63688935, 0.48210362, 0.05173155],
        [0.64407572, 0.4781157, 0.0511996],
        [0.65121289, 0.47406244, 0.05044367],
        [0.65830839, 0.46993917, 0.04941288],
    ]
    return _cmap("linear_phase", cm_data, reverse=reverse)


def cmap_diverging_curl(reverse=False):
    # cmocean, MIT license
    # diverging colormap, perceptually uniform
    cm_data = [
        [
            8.225559928700268419e-02,
            1.149244079727295142e-01,
            2.647901677800857390e-01,
        ],
        [
            8.312616532498406929e-02,
            1.190383729463048712e-01,
            2.668628892216621806e-01,
        ],
        [
            8.400180885962132971e-02,
            1.231074880892656653e-01,
            2.689526699064171411e-01,
        ],
        [
            8.487294239495335457e-02,
            1.271387529060027943e-01,
            2.710541708402016137e-01,
        ],
        [
            8.574385298640457842e-02,
            1.311333174761502018e-01,
            2.731691209373900975e-01,
        ],
        [
            8.661249189260347703e-02,
            1.350944971238551839e-01,
            2.752961432065319514e-01,
        ],
        [
            8.747533041314431435e-02,
            1.390258052165279645e-01,
            2.774332852121961235e-01,
        ],
        [
            8.833858505105957049e-02,
            1.429270910011002649e-01,
            2.795831537842536352e-01,
        ],
        [
            8.919012906146844832e-02,
            1.468043594975814992e-01,
            2.817400195447572475e-01,
        ],
        [
            9.004099984169053328e-02,
            1.506555099870153513e-01,
            2.839086654207542693e-01,
        ],
        [
            9.088231952195491292e-02,
            1.544850037627045203e-01,
            2.860850125083750362e-01,
        ],
        [
            9.171714479257989105e-02,
            1.582931942356169963e-01,
            2.882702798507874586e-01,
        ],
        [
            9.254607948203208423e-02,
            1.620811665705463311e-01,
            2.904645825457518593e-01,
        ],
        [
            9.336173420340779239e-02,
            1.658523274558137695e-01,
            2.926648040593683997e-01,
        ],
        [
            9.417284157369981701e-02,
            1.696050767223750977e-01,
            2.948744162588470830e-01,
        ],
        [
            9.496899572502048859e-02,
            1.733434725855039771e-01,
            2.970892156823352059e-01,
        ],
        [
            9.575619444438937533e-02,
            1.770666290075273708e-01,
            2.993115284087380368e-01,
        ],
        [
            9.653316478613682694e-02,
            1.807757562460599599e-01,
            3.015407883893915231e-01,
        ],
        [
            9.729328810023782359e-02,
            1.844734436312414905e-01,
            3.037745103921251633e-01,
        ],
        [
            9.804493118338306057e-02,
            1.881580898967480098e-01,
            3.060157402408537064e-01,
        ],
        [
            9.877832247043097369e-02,
            1.918329889556127654e-01,
            3.082609202522414993e-01,
        ],
        [
            9.949803783218733044e-02,
            1.954975058870322413e-01,
            3.105116763778897337e-01,
        ],
        [
            1.002054858430543316e-01,
            1.991518634625495388e-01,
            3.127684262427183892e-01,
        ],
        [
            1.008900241588315538e-01,
            2.027992883367119026e-01,
            3.150275553737127421e-01,
        ],
        [
            1.015620277820400430e-01,
            2.064376400065636719e-01,
            3.172925125709148420e-01,
        ],
        [
            1.022150454689789434e-01,
            2.100689913462399083e-01,
            3.195611195376787395e-01,
        ],
        [
            1.028468845169810686e-01,
            2.136942776676366007e-01,
            3.218326666201724029e-01,
        ],
        [
            1.034637486817424901e-01,
            2.173124203806320875e-01,
            3.241090419310820314e-01,
        ],
        [
            1.040556247342821483e-01,
            2.209261472703716311e-01,
            3.263871052200472134e-01,
        ],
        [
            1.046272664909374817e-01,
            2.245346804307608024e-01,
            3.286682704446855507e-01,
        ],
        [
            1.051814556007013568e-01,
            2.281377376539149293e-01,
            3.309532535866355762e-01,
        ],
        [
            1.057055066316897329e-01,
            2.317384538919968207e-01,
            3.332383062494437276e-01,
        ],
        [
            1.062093640276061124e-01,
            2.353348932541681759e-01,
            3.355262248019345583e-01,
        ],
        [
            1.066927192498384747e-01,
            2.389274243968986799e-01,
            3.378167764830257158e-01,
        ],
        [
            1.071428862568302165e-01,
            2.425189920877232619e-01,
            3.401063918909076889e-01,
        ],
        [
            1.075713140889580088e-01,
            2.461073946949010050e-01,
            3.423980926413837667e-01,
        ],
        [
            1.079763885418836000e-01,
            2.496932209057829977e-01,
            3.446912766824791197e-01,
        ],
        [
            1.083460004297124302e-01,
            2.532791299120676354e-01,
            3.469826761312421182e-01,
        ],
        [
            1.086913329090623825e-01,
            2.568630402753477870e-01,
            3.492750549670107785e-01,
        ],
        [
            1.090116287119651528e-01,
            2.604453159192556266e-01,
            3.515680214913912693e-01,
        ],
        [
            1.092932808921200649e-01,
            2.640287615628073015e-01,
            3.538580573547516761e-01,
        ],
        [
            1.095478763802813504e-01,
            2.676112773022403801e-01,
            3.561478615212890775e-01,
        ],
        [
            1.097748910210358808e-01,
            2.711931376089152246e-01,
            3.584370856671010852e-01,
        ],
        [
            1.099635342633853707e-01,
            2.747764822051754763e-01,
            3.607229892872333421e-01,
        ],
        [
            1.101198294511886444e-01,
            2.783603021914852760e-01,
            3.630068099573608986e-01,
        ],
        [
            1.102460152182262176e-01,
            2.819443225282238785e-01,
            3.652888319764409086e-01,
        ],
        [
            1.103361572207214036e-01,
            2.855297163446686715e-01,
            3.675674754730824945e-01,
        ],
        [
            1.103867349279119559e-01,
            2.891171759115234718e-01,
            3.698417464033080804e-01,
        ],
        [
            1.104047114339987423e-01,
            2.927055780381122019e-01,
            3.721129484539063559e-01,
        ],
        [
            1.103893448894039397e-01,
            2.962951553198432397e-01,
            3.743806401368951486e-01,
        ],
        [
            1.103290785873510815e-01,
            2.998879083652261635e-01,
            3.766420819050353419e-01,
        ],
        [
            1.102317288825286901e-01,
            3.034825829921489193e-01,
            3.788986922133656954e-01,
        ],
        [
            1.100986315611906241e-01,
            3.070790351009552999e-01,
            3.811504545068737926e-01,
        ],
        [
            1.099286556573810802e-01,
            3.106775192369479188e-01,
            3.833968205472055302e-01,
        ],
        [
            1.097092559883022234e-01,
            3.142800415550652815e-01,
            3.856349205402823110e-01,
        ],
        [
            1.094518269158459012e-01,
            3.178848431435130073e-01,
            3.878667847148202785e-01,
        ],
        [
            1.091556968975302966e-01,
            3.214920812428978536e-01,
            3.900919340676701208e-01,
        ],
        [
            1.088202096165073185e-01,
            3.251019032868823211e-01,
            3.923098843692563453e-01,
        ],
        [
            1.084337294201929702e-01,
            3.287160421828903556e-01,
            3.945179917556369542e-01,
        ],
        [
            1.080052802278752000e-01,
            3.323331728550899533e-01,
            3.967176863054378000e-01,
        ],
        [
            1.075355258379605550e-01,
            3.359532282299735328e-01,
            3.989087127976621017e-01,
        ],
        [
            1.070239159802940931e-01,
            3.395763147211236510e-01,
            4.010905648833596460e-01,
        ],
        [
            1.064666158592602885e-01,
            3.432029795356145718e-01,
            4.032620996037361571e-01,
        ],
        [
            1.058582376509708545e-01,
            3.468339423292918222e-01,
            4.054218838433404359e-01,
        ],
        [
            1.052065591856250482e-01,
            3.504681464569319171e-01,
            4.075709632165070984e-01,
        ],
        [
            1.045112201334900126e-01,
            3.541056562885774861e-01,
            4.097088092956981398e-01,
        ],
        [
            1.037719209811681642e-01,
            3.577465259466254266e-01,
            4.118348877541359032e-01,
        ],
        [
            1.029884320307208612e-01,
            3.613907991323849767e-01,
            4.139486582680417803e-01,
        ],
        [
            1.021513134274243950e-01,
            3.650396452261166491e-01,
            4.160478671051655586e-01,
        ],
        [
            1.012689167529539358e-01,
            3.686920150348446112e-01,
            4.181335233490640069e-01,
        ],
        [
            1.003423119365809690e-01,
            3.723477936835040136e-01,
            4.202052548968338574e-01,
        ],
        [
            9.937169919107982641e-02,
            3.760069784468507703e-01,
            4.222625006231348066e-01,
        ],
        [
            9.835741884413440328e-02,
            3.796695548525758634e-01,
            4.243046936775203282e-01,
        ],
        [
            9.729997123759509536e-02,
            3.833354963232004087e-01,
            4.263312615677605777e-01,
        ],
        [
            9.620003933222870396e-02,
            3.870047637840662302e-01,
            4.283416262899890081e-01,
        ],
        [
            9.505172587236093706e-02,
            3.906780327832828914e-01,
            4.303339883746660766e-01,
        ],
        [
            9.386233813144639893e-02,
            3.943545459798681874e-01,
            4.323088724355508838e-01,
        ],
        [
            9.263427266200571775e-02,
            3.980341179549674036e-01,
            4.342658626828024837e-01,
        ],
        [
            9.136927887187012987e-02,
            4.017166535612498035e-01,
            4.362043674792987491e-01,
        ],
        [
            9.006945702453716951e-02,
            4.054020428715323643e-01,
            4.381237915805220595e-01,
        ],
        [
            8.873730500447504776e-02,
            4.090901606132017476e-01,
            4.400235366709063789e-01,
        ],
        [
            8.737577058920215078e-02,
            4.127808655736769361e-01,
            4.419030019956885491e-01,
        ],
        [
            8.598830961259482097e-02,
            4.164739999785817548e-01,
            4.437615850971945997e-01,
        ],
        [
            8.457895032121595658e-02,
            4.201693888446985103e-01,
            4.455986826648858368e-01,
        ],
        [
            8.315236408743081897e-02,
            4.238668393102046350e-01,
            4.474136915088433031e-01,
        ],
        [
            8.171394242970148047e-02,
            4.275661399451892164e-01,
            4.492060096666721791e-01,
        ],
        [
            8.026987997778653461e-02,
            4.312670600459782566e-01,
            4.509750376540915817e-01,
        ],
        [
            7.882726258105521300e-02,
            4.349693489173894201e-01,
            4.527201798696426915e-01,
        ],
        [
            7.739415915996109008e-02,
            4.386727351476746306e-01,
            4.544408461640829233e-01,
        ],
        [
            7.597971511267428979e-02,
            4.423769258816079852e-01,
            4.561364535850265800e-01,
        ],
        [
            7.459424408415230023e-02,
            4.460816060979165276e-01,
            4.578064283072901808e-01,
        ],
        [
            7.324931366840245484e-02,
            4.497864378980456768e-01,
            4.594502077591564038e-01,
        ],
        [
            7.195781915786156335e-02,
            4.534910598140922677e-01,
            4.610672429543411499e-01,
        ],
        [
            7.073403782879061907e-02,
            4.571950861446216208e-01,
            4.626570010388615928e-01,
        ],
        [
            6.959365457471067273e-02,
            4.608981063279830592e-01,
            4.642189680611767399e-01,
        ],
        [
            6.855374817251533304e-02,
            4.645996843636931994e-01,
            4.657526519729214276e-01,
        ],
        [
            6.763272639280798471e-02,
            4.682993582933911436e-01,
            4.672575858662252890e-01,
        ],
        [
            6.685019795786503738e-02,
            4.719966397538147285e-01,
            4.687333314519904204e-01,
        ],
        [
            6.622677049492370349e-02,
            4.756910136151853430e-01,
            4.701794827815656830e-01,
        ],
        [
            6.577673858968982601e-02,
            4.793824370720338179e-01,
            4.715941633832017588e-01,
        ],
        [
            6.552566064603559948e-02,
            4.830700650743400826e-01,
            4.729777438223161101e-01,
        ],
        [
            6.549820807888259711e-02,
            4.867530881918184504e-01,
            4.743305399824718216e-01,
        ],
        [
            6.571558023976076246e-02,
            4.904308747270616498e-01,
            4.756523204648347991e-01,
        ],
        [
            6.619782080433814220e-02,
            4.941027658684106760e-01,
            4.769429100625798834e-01,
        ],
        [
            6.696293828126623215e-02,
            4.977680989992983585e-01,
            4.782021118153178540e-01,
        ],
        [
            6.801610562745827315e-02,
            5.014269919387287500e-01,
            4.794267081520149909e-01,
        ],
        [
            6.938287907938911481e-02,
            5.050778255979795350e-01,
            4.806197953737798012e-01,
        ],
        [
            7.107372065756567547e-02,
            5.087198306495862576e-01,
            4.817814896929000779e-01,
        ],
        [
            7.309574065371191032e-02,
            5.123522156200341904e-01,
            4.829119931483520367e-01,
        ],
        [
            7.544312997722565917e-02,
            5.159750173542567708e-01,
            4.840076729265158639e-01,
        ],
        [
            7.812721320542403980e-02,
            5.195865216476734938e-01,
            4.850725749743695636e-01,
        ],
        [
            8.114572394888117102e-02,
            5.231858403590214923e-01,
            4.861073630469811557e-01,
        ],
        [
            8.448832972524200624e-02,
            5.267726392289812098e-01,
            4.871097239159773440e-01,
        ],
        [
            8.815110303261089464e-02,
            5.303457163263245455e-01,
            4.880817131293228583e-01,
        ],
        [
            9.212706115366336990e-02,
            5.339038791645212001e-01,
            4.890257976801760109e-01,
        ],
        [
            9.640117372078826907e-02,
            5.374467824904106683e-01,
            4.899392661237967350e-01,
        ],
        [
            1.009651127375016111e-01,
            5.409730397620680087e-01,
            4.908260102866368046e-01,
        ],
        [
            1.058058868411170528e-01,
            5.444817357603629615e-01,
            4.916873206428047927e-01,
        ],
        [
            1.109091719419828259e-01,
            5.479722539284174188e-01,
            4.925220286879308795e-01,
        ],
        [
            1.162631754482068569e-01,
            5.514432364311973034e-01,
            4.933355557142476422e-01,
        ],
        [
            1.218535592637135234e-01,
            5.548942058020517321e-01,
            4.941256571865651481e-01,
        ],
        [
            1.276672732366210816e-01,
            5.583239554235875923e-01,
            4.948978636889357907e-01,
        ],
        [
            1.336912106530599997e-01,
            5.617318570854707982e-01,
            4.956519172255148820e-01,
        ],
        [
            1.399119531735926458e-01,
            5.651170059000043544e-01,
            4.963918396953513335e-01,
        ],
        [
            1.463171276735238113e-01,
            5.684787369209851615e-01,
            4.971190242696297834e-01,
        ],
        [
            1.528937099908951325e-01,
            5.718163393279495077e-01,
            4.978371217540351057e-01,
        ],
        [
            1.596300036906863895e-01,
            5.751292412901443107e-01,
            4.985481743532478860e-01,
        ],
        [
            1.665133003434038084e-01,
            5.784169089899582339e-01,
            4.992561455145328453e-01,
        ],
        [
            1.735328783097749850e-01,
            5.816789154432452369e-01,
            4.999631315071642601e-01,
        ],
        [
            1.806761031013389140e-01,
            5.849149331180006905e-01,
            5.006736479698321585e-01,
        ],
        [
            1.879334378838529440e-01,
            5.881246912104457492e-01,
            5.013896313522919757e-01,
        ],
        [
            1.952924636272905801e-01,
            5.913080959200207598e-01,
            5.021159025525618880e-01,
        ],
        [
            2.027443124327554802e-01,
            5.944650539898058694e-01,
            5.028546409645925364e-01,
        ],
        [
            2.102776619158149840e-01,
            5.975956842983582984e-01,
            5.036102222376415138e-01,
        ],
        [
            2.178835011739876371e-01,
            6.007001216855215597e-01,
            5.043855354959408954e-01,
        ],
        [
            2.255521696872271886e-01,
            6.037786523436265984e-01,
            5.051841613954050070e-01,
        ],
        [
            2.332749143253212143e-01,
            6.068316286127126702e-01,
            5.060092633925864503e-01,
        ],
        [
            2.410430130087069522e-01,
            6.098595200479223211e-01,
            5.068641518721540562e-01,
        ],
        [
            2.488489441844971561e-01,
            6.128628192186393875e-01,
            5.077515718650474907e-01,
        ],
        [
            2.566840197606024554e-01,
            6.158422311486778655e-01,
            5.086750547256451149e-01,
        ],
        [
            2.645425291505308918e-01,
            6.187983086880044503e-01,
            5.096365792929340444e-01,
        ],
        [
            2.724162323640093031e-01,
            6.217319406932720893e-01,
            5.106395912364674050e-01,
        ],
        [
            2.803003746086680792e-01,
            6.246437759477415641e-01,
            5.116857725517640620e-01,
        ],
        [
            2.881881143962810587e-01,
            6.275347641630057982e-01,
            5.127779478270290126e-01,
        ],
        [
            2.960748324121407205e-01,
            6.304057046767445049e-01,
            5.139178767894679867e-01,
        ],
        [
            3.039555214161791530e-01,
            6.332575133378499643e-01,
            5.151075596956975478e-01,
        ],
        [
            3.118254758119217707e-01,
            6.360911463304157465e-01,
            5.163488722475468862e-01,
        ],
        [
            3.196814435511296515e-01,
            6.389074409416231060e-01,
            5.176430585409529384e-01,
        ],
        [
            3.275188103490194735e-01,
            6.417074699067215615e-01,
            5.189919719540163623e-01,
        ],
        [
            3.353355552299603914e-01,
            6.444920106677175520e-01,
            5.203963563323180663e-01,
        ],
        [
            3.431277348645550562e-01,
            6.472621506436356809e-01,
            5.218577640245062321e-01,
        ],
        [
            3.508936232465371674e-01,
            6.500187029053001719e-01,
            5.233768303957324619e-01,
        ],
        [
            3.586308928051362699e-01,
            6.527625972609284455e-01,
            5.249544352005411918e-01,
        ],
        [
            3.663368289249827603e-01,
            6.554948605761221625e-01,
            5.265915743478537525e-01,
        ],
        [
            3.740119682194762429e-01,
            6.582160193662682790e-01,
            5.282880419647097980e-01,
        ],
        [
            3.816510562742471135e-01,
            6.609275747235534570e-01,
            5.300456830101799577e-01,
        ],
        [
            3.892580517875900981e-01,
            6.636294950347043642e-01,
            5.318631054022345817e-01,
        ],
        [
            3.968261890078971788e-01,
            6.663236061846555813e-01,
            5.337425455110953454e-01,
        ],
        [
            4.043593499172888350e-01,
            6.690098785171258999e-01,
            5.356826761355167887e-01,
        ],
        [
            4.118554481683104340e-01,
            6.716893377862352965e-01,
            5.376841277217632165e-01,
        ],
        [
            4.193119538935562440e-01,
            6.743631277083362852e-01,
            5.397475699351562684e-01,
        ],
        [
            4.267325988888523436e-01,
            6.770311866202418649e-01,
            5.418718349209995511e-01,
        ],
        [
            4.341129901223799714e-01,
            6.796950319734580415e-01,
            5.440580596655568701e-01,
        ],
        [
            4.414547339722453279e-01,
            6.823550079810395408e-01,
            5.463056567639269501e-01,
        ],
        [
            4.487598229028739172e-01,
            6.850113432670585922e-01,
            5.486140038956078824e-01,
        ],
        [
            4.560240745098563253e-01,
            6.876655632831355502e-01,
            5.509839689679422170e-01,
        ],
        [
            4.632498634530364812e-01,
            6.903178139102768007e-01,
            5.534147775766539157e-01,
        ],
        [
            4.704389351347622594e-01,
            6.929683367461523247e-01,
            5.559058726658481220e-01,
        ],
        [
            4.775890398856753039e-01,
            6.956182556045346077e-01,
            5.584575291026864230e-01,
        ],
        [
            4.846997162615552246e-01,
            6.982683108816961637e-01,
            5.610695620964348818e-01,
        ],
        [
            4.917741270603506742e-01,
            7.009183842407572529e-01,
            5.637411222277634026e-01,
        ],
        [
            4.988124547076915882e-01,
            7.035690215604037956e-01,
            5.664719533702552434e-01,
        ],
        [
            5.058115298480653221e-01,
            7.062215879970826782e-01,
            5.692622613027222833e-01,
        ],
        [
            5.127738759690677606e-01,
            7.088760718122417703e-01,
            5.721113127309581659e-01,
        ],
        [
            5.197010257328686933e-01,
            7.115326679134365007e-01,
            5.750185876848199484e-01,
        ],
        [
            5.265932673521412921e-01,
            7.141918646847531527e-01,
            5.779837442967735717e-01,
        ],
        [
            5.334494816269396145e-01,
            7.168545129510710545e-01,
            5.810065526719623286e-01,
        ],
        [
            5.402690647877386176e-01,
            7.195213413684249382e-01,
            5.840866494502513495e-01,
        ],
        [
            5.470548736207613283e-01,
            7.221921468817737999e-01,
            5.872233804977959881e-01,
        ],
        [
            5.538072551957783363e-01,
            7.248673679611095100e-01,
            5.904163410524770894e-01,
        ],
        [
            5.605265661533928023e-01,
            7.275474322700724583e-01,
            5.936651120515976654e-01,
        ],
        [
            5.672131712764029166e-01,
            7.302327570205698892e-01,
            5.969692609600730782e-01,
        ],
        [
            5.738649923321349489e-01,
            7.329244536181049874e-01,
            6.003283620189617809e-01,
        ],
        [
            5.804845702488933279e-01,
            7.356223182652517067e-01,
            6.037418650719156288e-01,
        ],
        [
            5.870727421002424062e-01,
            7.383266077479672118e-01,
            6.072092971993915400e-01,
        ],
        [
            5.936298933201957784e-01,
            7.410376988478269977e-01,
            6.107301851240671819e-01,
        ],
        [
            6.001564124519274124e-01,
            7.437559595200373685e-01,
            6.143040456187923715e-01,
        ],
        [
            6.066526905401021796e-01,
            7.464817491552263595e-01,
            6.179303860708607044e-01,
        ],
        [
            6.131191206125891080e-01,
            7.492154188267443615e-01,
            6.216087050224498034e-01,
        ],
        [
            6.195560972423146406e-01,
            7.519573115237726535e-01,
            6.253384926911926822e-01,
        ],
        [
            6.259635861936422296e-01,
            7.547078996712067722e-01,
            6.291191822939783407e-01,
        ],
        [
            6.323414409254812796e-01,
            7.574676913865331374e-01,
            6.329501570682624090e-01,
        ],
        [
            6.386911927456534466e-01,
            7.602366470910791874e-01,
            6.368310037415121361e-01,
        ],
        [
            6.450132383997043695e-01,
            7.630150778921287458e-01,
            6.407611911364364810e-01,
        ],
        [
            6.513079749051275957e-01,
            7.658032878094622742e-01,
            6.447401822997557153e-01,
        ],
        [
            6.575757994324034073e-01,
            7.686015739346664377e-01,
            6.487674349657708284e-01,
        ],
        [
            6.638171092147175933e-01,
            7.714102265818907345e-01,
            6.528424020163275943e-01,
        ],
        [
            6.700323014813579503e-01,
            7.742295294309987641e-01,
            6.569645319377305226e-01,
        ],
        [
            6.762217734101813038e-01,
            7.770597596640953508e-01,
            6.611332692747456941e-01,
        ],
        [
            6.823859220949484161e-01,
            7.799011880964143995e-01,
            6.653480550814426797e-01,
        ],
        [
            6.885251445237092760e-01,
            7.827540793025653532e-01,
            6.696083273682165160e-01,
        ],
        [
            6.946398375648411561e-01,
            7.856186917391158042e-01,
            6.739135215439332471e-01,
        ],
        [
            7.007303979576740005e-01,
            7.884952778644843674e-01,
            6.782630708517513041e-01,
        ],
        [
            7.067972223051004477e-01,
            7.913840842570615264e-01,
            6.826564067967675342e-01,
        ],
        [
            7.128407070658809852e-01,
            7.942853517324697243e-01,
            6.870929595632513376e-01,
        ],
        [
            7.188612485448663270e-01,
            7.971993154607720511e-01,
            6.915721584188375681e-01,
        ],
        [
            7.248592428796667431e-01,
            8.001262050844080154e-01,
            6.960934321026465144e-01,
        ],
        [
            7.308350860228653989e-01,
            8.030662448375227580e-01,
            7.006562091939169123e-01,
        ],
        [
            7.367891737192681090e-01,
            8.060196536672460388e-01,
            7.052599184573171698e-01,
        ],
        [
            7.427219014782563411e-01,
            8.089866453573647531e-01,
            7.099039891607071828e-01,
        ],
        [
            7.486327256130643759e-01,
            8.119678017125729896e-01,
            7.145873998348200029e-01,
        ],
        [
            7.545223076817887398e-01,
            8.149632306197714948e-01,
            7.193096566367255251e-01,
        ],
        [
            7.603915796412942241e-01,
            8.179729213555224643e-01,
            7.240704295566047222e-01,
        ],
        [
            7.662409381414175824e-01,
            8.209970689783633313e-01,
            7.288691437189614986e-01,
        ],
        [
            7.720707796269933310e-01,
            8.240358639329949941e-01,
            7.337052258319404219e-01,
        ],
        [
            7.778815003305534770e-01,
            8.270894921786368092e-01,
            7.385781042557458820e-01,
        ],
        [
            7.836734962813408645e-01,
            8.301581353160575327e-01,
            7.434872090029538416e-01,
        ],
        [
            7.894471633387081244e-01,
            8.332419707110174656e-01,
            7.484319716624078245e-01,
        ],
        [
            7.952028972601549173e-01,
            8.363411716110775718e-01,
            7.534118252377455249e-01,
        ],
        [
            8.009401766621723207e-01,
            8.394563042330350777e-01,
            7.584255820860429376e-01,
        ],
        [
            8.066584706735069332e-01,
            8.425879497641356464e-01,
            7.634719632765348818e-01,
        ],
        [
            8.123599093553812711e-01,
            8.457355276105180675e-01,
            7.685515296147656938e-01,
        ],
        [
            8.180448941186928558e-01,
            8.488991950022984900e-01,
            7.736637090147417961e-01,
        ],
        [
            8.237138279483190439e-01,
            8.520791051833870311e-01,
            7.788079287668441264e-01,
        ],
        [
            8.293671160911614271e-01,
            8.552754073408689317e-01,
            7.839836146965878383e-01,
        ],
        [
            8.350048677827189847e-01,
            8.584883831868801440e-01,
            7.891899443847590900e-01,
        ],
        [
            8.406246724049463159e-01,
            8.617194786977677712e-01,
            7.944239257301034529e-01,
        ],
        [
            8.462299834685677036e-01,
            8.649674562084326279e-01,
            7.996873827745283325e-01,
        ],
        [
            8.518212329614019973e-01,
            8.682324447773152043e-01,
            8.049797193798620132e-01,
        ],
        [
            8.573988637074910768e-01,
            8.715145671024431273e-01,
            8.103003320898716222e-01,
        ],
        [
            8.629633327895804840e-01,
            8.748139384163003962e-01,
            8.156486084917724533e-01,
        ],
        [
            8.685112937853189941e-01,
            8.781325055194139084e-01,
            8.210202040569095638e-01,
        ],
        [
            8.740469282893844616e-01,
            8.814686228402575097e-01,
            8.264178662740626624e-01,
        ],
        [
            8.795708463666609411e-01,
            8.848223352046364898e-01,
            8.318410153090299852e-01,
        ],
        [
            8.850836254841629724e-01,
            8.881937049832523412e-01,
            8.372889893254339411e-01,
        ],
        [
            8.905836610629007666e-01,
            8.915838848352710677e-01,
            8.427587078675609078e-01,
        ],
        [
            8.960718329388820402e-01,
            8.949928217018373600e-01,
            8.482495190363266158e-01,
        ],
        [
            9.015509263802756745e-01,
            8.984195016922670307e-01,
            8.537628451897162352e-01,
        ],
        [
            9.070218374764418279e-01,
            9.018638497314315217e-01,
            8.592980228813623667e-01,
        ],
        [
            9.124832972967743538e-01,
            9.053269113370198129e-01,
            8.648517190341429295e-01,
        ],
        [
            9.179365336943248188e-01,
            9.088084827838653901e-01,
            8.704232606428425889e-01,
        ],
        [
            9.233851804191220980e-01,
            9.123071100087158936e-01,
            8.760148319228351355e-01,
        ],
        [
            9.288308811012930821e-01,
            9.158223472192428272e-01,
            8.816263177427966502e-01,
        ],
        [
            9.342716413123769437e-01,
            9.193556495997508016e-01,
            8.872531405900644375e-01,
        ],
        [
            9.397124373542273812e-01,
            9.229047657151164819e-01,
            8.928998260600508052e-01,
        ],
        [
            9.451563753217823161e-01,
            9.264682865796181055e-01,
            8.985697730985615639e-01,
        ],
        [
            9.506035559047821826e-01,
            9.300461763422669392e-01,
            9.042646579991682199e-01,
        ],
        [
            9.560531046363628382e-01,
            9.336385357088663461e-01,
            9.099886803187530182e-01,
        ],
        [
            9.615066616129493982e-01,
            9.372434217616608665e-01,
            9.157560566822336989e-01,
        ],
        [
            9.669573847273637002e-01,
            9.408624710997687268e-01,
            9.215795307640300971e-01,
        ],
        [
            9.723870692594612786e-01,
            9.445024597948724621e-01,
            9.274670258562995873e-01,
        ],
        [
            9.777785730890226068e-01,
            9.481687534308861354e-01,
            9.334364948680430318e-01,
        ],
        [
            9.831050718338244510e-01,
            9.518727670560837018e-01,
            9.394860306213083101e-01,
        ],
        [
            9.883417388454437402e-01,
            9.556282921109976458e-01,
            9.455836323325411685e-01,
        ],
        [
            9.934918422996558141e-01,
            9.594375624216472387e-01,
            9.516983192548315040e-01,
        ],
        [
            9.985763296811461798e-01,
            9.632965417140263442e-01,
            9.577895036430327247e-01,
        ],
        [
            9.942114721489739848e-01,
            9.649414783718816002e-01,
            9.591713509300946461e-01,
        ],
        [
            9.916915526798163460e-01,
            9.600677293546330260e-01,
            9.527406681900515428e-01,
        ],
        [
            9.892073759214962125e-01,
            9.552017644060696311e-01,
            9.462702365737246657e-01,
        ],
        [
            9.867719407557972167e-01,
            9.503380654950176476e-01,
            9.397586228881678050e-01,
        ],
        [
            9.843739071729306067e-01,
            9.454788135288768602e-01,
            9.332265558186634280e-01,
        ],
        [
            9.820182926871906526e-01,
            9.406217084851765664e-01,
            9.266730991029579201e-01,
        ],
        [
            9.797019478013845317e-01,
            9.357670195072623764e-01,
            9.201050706729160256e-01,
        ],
        [
            9.774207980730996725e-01,
            9.309154126689619391e-01,
            9.135293740478817037e-01,
        ],
        [
            9.751815609868391688e-01,
            9.260643851639969171e-01,
            9.069399044850446900e-01,
        ],
        [
            9.729704910473376822e-01,
            9.212176417076594070e-01,
            9.003536220502811327e-01,
        ],
        [
            9.708034919455280631e-01,
            9.163699401531895106e-01,
            8.937532865598888376e-01,
        ],
        [
            9.686635749176782939e-01,
            9.115260705110270756e-01,
            8.871590238431372732e-01,
        ],
        [
            9.665594650012595546e-01,
            9.066829842770773862e-01,
            8.805615104307024099e-01,
        ],
        [
            9.644872784946666444e-01,
            9.018415117599095643e-01,
            8.739656672915365743e-01,
        ],
        [
            9.624420742140847862e-01,
            8.970028582796596428e-01,
            8.673774626543144795e-01,
        ],
        [
            9.604345584612016262e-01,
            8.921632903093835720e-01,
            8.607852860310053478e-01,
        ],
        [
            9.584498054598472594e-01,
            8.873272041947983801e-01,
            8.542061390733795001e-01,
        ],
        [
            9.564989754176022041e-01,
            8.824906944948268661e-01,
            8.476279025304513937e-01,
        ],
        [
            9.545749598026603833e-01,
            8.776557062005478915e-01,
            8.410587414202306267e-01,
        ],
        [
            9.526745457712032517e-01,
            8.728229738617154787e-01,
            8.345024009748316374e-01,
        ],
        [
            9.508087846256844111e-01,
            8.679885222040847337e-01,
            8.279470532549256800e-01,
        ],
        [
            9.489631025192423186e-01,
            8.631568397645421609e-01,
            8.214088147188137734e-01,
        ],
        [
            9.471457599180185261e-01,
            8.583248540920686009e-01,
            8.148789280451533834e-01,
        ],
        [
            9.453550305765402451e-01,
            8.534927996091392632e-01,
            8.083595091982623826e-01,
        ],
        [
            9.435830323389927665e-01,
            8.486630445127123501e-01,
            8.018591800395635794e-01,
        ],
        [
            9.418425662160879730e-01,
            8.438308651791852633e-01,
            7.953645386207840451e-01,
        ],
        [
            9.401224124677813876e-01,
            8.389997911592477209e-01,
            7.888877269212305476e-01,
        ],
        [
            9.384205871436177571e-01,
            8.341702205035793627e-01,
            7.824309818729748844e-01,
        ],
        [
            9.367501034134483318e-01,
            8.293372224294222050e-01,
            7.759809608693934990e-01,
        ],
        [
            9.350962812812430025e-01,
            8.245056601392387607e-01,
            7.695531958095181979e-01,
        ],
        [
            9.334610667718560295e-01,
            8.196745424298020888e-01,
            7.631458380069808811e-01,
        ],
        [
            9.318539060108851357e-01,
            8.148400979617762552e-01,
            7.567494905851217535e-01,
        ],
        [
            9.302622555140654947e-01,
            8.100065567310004155e-01,
            7.503772218901773039e-01,
        ],
        [
            9.286876056094349741e-01,
            8.051730724177085241e-01,
            7.440277117015546837e-01,
        ],
        [
            9.271395831502474705e-01,
            8.003357056772891776e-01,
            7.376916134646933632e-01,
        ],
        [
            9.256059253327618697e-01,
            7.954987025858116789e-01,
            7.313814866564718464e-01,
        ],
        [
            9.240863437601837260e-01,
            7.906618776065421628e-01,
            7.250978248201844778e-01,
        ],
        [
            9.225925658427436282e-01,
            7.858203843156221780e-01,
            7.188294627149656169e-01,
        ],
        [
            9.211126169365579930e-01,
            7.809784744974170856e-01,
            7.125884635347393692e-01,
        ],
        [
            9.196455684792974594e-01,
            7.761362045971830215e-01,
            7.063759865046427278e-01,
        ],
        [
            9.181979022265810420e-01,
            7.712906810954774928e-01,
            7.001861662941214481e-01,
        ],
        [
            9.167672001571998130e-01,
            7.664424894801199484e-01,
            6.940217357022171463e-01,
        ],
        [
            9.153481567945904729e-01,
            7.615934195093969628e-01,
            6.878880649909780987e-01,
        ],
        [
            9.139404639768551331e-01,
            7.567432836340363123e-01,
            6.817857667786046960e-01,
        ],
        [
            9.125539294301500126e-01,
            7.518876928783747582e-01,
            6.757062380855892725e-01,
        ],
        [
            9.111780957235272593e-01,
            7.470305845086899765e-01,
            6.696595752391263368e-01,
        ],
        [
            9.098122501649290594e-01,
            7.421719339914916169e-01,
            6.636468136699643638e-01,
        ],
        [
            9.084563128768237128e-01,
            7.373114504136536462e-01,
            6.576684342801734084e-01,
        ],
        [
            9.071185731273107011e-01,
            7.324452193667679856e-01,
            6.517176237314421527e-01,
        ],
        [
            9.057893354554222842e-01,
            7.275770233727173464e-01,
            6.458034937673092779e-01,
        ],
        [
            9.044682125236334080e-01,
            7.227067015228565428e-01,
            6.399268508324190696e-01,
        ],
        [
            9.031548045364521382e-01,
            7.178340969900336432e-01,
            6.340885324865254136e-01,
        ],
        [
            9.018536281154535539e-01,
            7.129568373829493488e-01,
            6.282852974032566706e-01,
        ],
        [
            9.005618093543485969e-01,
            7.080758191596225881e-01,
            6.225202235043866272e-01,
        ],
        [
            8.992759701121831872e-01,
            7.031922144373208283e-01,
            6.167967177972875081e-01,
        ],
        [
            8.979956379512032960e-01,
            6.983059000713781606e-01,
            6.111157531581823399e-01,
        ],
        [
            8.967203212860314077e-01,
            6.934167616666734313e-01,
            6.054783383481375791e-01,
        ],
        [
            8.954526708976771054e-01,
            6.885231926405954717e-01,
            5.998830635410449252e-01,
        ],
        [
            8.941915566016080952e-01,
            6.836253365962329243e-01,
            5.943315847613384051e-01,
        ],
        [
            8.929334172678807802e-01,
            6.787245284319090022e-01,
            5.888273795844850556e-01,
        ],
        [
            8.916776705242244194e-01,
            6.738207055230612808e-01,
            5.833715948784413685e-01,
        ],
        [
            8.904237095992360018e-01,
            6.689138192653601989e-01,
            5.779654133729836829e-01,
        ],
        [
            8.891709022410747565e-01,
            6.640038362746348843e-01,
            5.726100532447696567e-01,
        ],
        [
            8.879187220887899690e-01,
            6.590906724758603952e-01,
            5.673066752652388134e-01,
        ],
        [
            8.866700510547862457e-01,
            6.541724962989774461e-01,
            5.620541403257021118e-01,
        ],
        [
            8.854200814778028228e-01,
            6.492513861023391231e-01,
            5.568566631651752363e-01,
        ],
        [
            8.841680786914359880e-01,
            6.443273831269403784e-01,
            5.517155748042765762e-01,
        ],
        [
            8.829132805112128723e-01,
            6.394005490891804255e-01,
            5.466322335097351104e-01,
        ],
        [
            8.816548969914349554e-01,
            6.344709672901969189e-01,
            5.416080224154796730e-01,
        ],
        [
            8.803921103664992254e-01,
            6.295387436822825755e-01,
            5.366443467601184070e-01,
        ],
        [
            8.791240751896489680e-01,
            6.246040078804957485e-01,
            5.317426307330340718e-01,
        ],
        [
            8.778499186810901911e-01,
            6.196669141071349252e-01,
            5.269043139249947050e-01,
        ],
        [
            8.765687412960717628e-01,
            6.147276420564155019e-01,
            5.221308473833028430e-01,
        ],
        [
            8.752796175219744734e-01,
            6.097863976665317542e-01,
            5.174236892760738504e-01,
        ],
        [
            8.739815969115529715e-01,
            6.048434137862945814e-01,
            5.127843001752147023e-01,
        ],
        [
            8.726737941588253999e-01,
            5.998988989392898263e-01,
            5.082140946168248741e-01,
        ],
        [
            8.713557496267209102e-01,
            5.949528226638209905e-01,
            5.037142772058214035e-01,
        ],
        [
            8.700256052408116281e-01,
            5.900059904309469250e-01,
            4.992866995883939452e-01,
        ],
        [
            8.686823445912698061e-01,
            5.850587401058766623e-01,
            4.949327569364067592e-01,
        ],
        [
            8.673249354213553586e-01,
            5.801114372307474287e-01,
            4.906538189940125583e-01,
        ],
        [
            8.659523319452930856e-01,
            5.751644748762787529e-01,
            4.864512237593011101e-01,
        ],
        [
            8.645634773771747605e-01,
            5.702182733234352208e-01,
            4.823262709991545383e-01,
        ],
        [
            8.631573066573615671e-01,
            5.652732795695735168e-01,
            4.782802156484906031e-01,
        ],
        [
            8.617327493598900823e-01,
            5.603299666552966629e-01,
            4.743142611496265482e-01,
        ],
        [
            8.602887327613949475e-01,
            5.553888328102728478e-01,
            4.704295527914130193e-01,
        ],
        [
            8.588244189007790963e-01,
            5.504502458314576296e-01,
            4.666271134383851993e-01,
        ],
        [
            8.573388771464994784e-01,
            5.455146532392860514e-01,
            4.629079425847138496e-01,
        ],
        [
            8.558307110590109845e-01,
            5.405828402802138610e-01,
            4.592730689337449212e-01,
        ],
        [
            8.542988567054966564e-01,
            5.356554029582069054e-01,
            4.557233480219839428e-01,
        ],
        [
            8.527422657992969057e-01,
            5.307329553519699594e-01,
            4.522595444303549317e-01,
        ],
        [
            8.511599092771463537e-01,
            5.258161276783985816e-01,
            4.488823265086418490e-01,
        ],
        [
            8.495507808257551918e-01,
            5.209055642285482790e-01,
            4.455922615760174454e-01,
        ],
        [
            8.479139003246871642e-01,
            5.160019211927755478e-01,
            4.423898116530999292e-01,
        ],
        [
            8.462483171732270160e-01,
            5.111058643932878676e-01,
            4.392753297751230135e-01,
        ],
        [
            8.445531134701587117e-01,
            5.062180669436533442e-01,
            4.362490569289804720e-01,
        ],
        [
            8.428274070171406507e-01,
            5.013392068558483183e-01,
            4.333111196492664408e-01,
        ],
        [
            8.410703541185753362e-01,
            4.964699646160714575e-01,
            4.304615283001137493e-01,
        ],
        [
            8.392811521535089581e-01,
            4.916110207509353791e-01,
            4.277001760608312164e-01,
        ],
        [
            8.374593644075595256e-01,
            4.867627987429819503e-01,
            4.250269048992098009e-01,
        ],
        [
            8.356043139975503076e-01,
            4.819259312622626301e-01,
            4.224414243859783702e-01,
        ],
        [
            8.337148868611683472e-01,
            4.771014353948369036e-01,
            4.199431953989596344e-01,
        ],
        [
            8.317904658009995789e-01,
            4.722899701137897588e-01,
            4.175316375108732991e-01,
        ],
        [
            8.298304844983901418e-01,
            4.674921821164159108e-01,
            4.152060584430907197e-01,
        ],
        [
            8.278344282915189867e-01,
            4.627087037890093568e-01,
            4.129656573155296440e-01,
        ],
        [
            8.258018346451376779e-01,
            4.579401513029328075e-01,
            4.108095284678619508e-01,
        ],
        [
            8.237322933175019735e-01,
            4.531871228543432051e-01,
            4.087366658020525345e-01,
        ],
        [
            8.216256878784896633e-01,
            4.484499819155622347e-01,
            4.067461112065531847e-01,
        ],
        [
            8.194815690724320811e-01,
            4.437294051177347876e-01,
            4.048366204140803060e-01,
        ],
        [
            8.172995050178583076e-01,
            4.390260854893064946e-01,
            4.030068099238640067e-01,
        ],
        [
            8.150792968857805132e-01,
            4.343405321271661679e-01,
            4.012553165972070901e-01,
        ],
        [
            8.128207950280410543e-01,
            4.296732294003547947e-01,
            3.995807052170325946e-01,
        ],
        [
            8.105238975108269850e-01,
            4.250246362540385792e-01,
            3.979814747698801614e-01,
        ],
        [
            8.081885484630557670e-01,
            4.203951856851556590e-01,
            3.964560648094507256e-01,
        ],
        [
            8.058148470586988799e-01,
            4.157851737769109879e-01,
            3.950029765120905423e-01,
        ],
        [
            8.034026962411985329e-01,
            4.111951046689115152e-01,
            3.936204324142628108e-01,
        ],
        [
            8.009521378981909745e-01,
            4.066253627118514569e-01,
            3.923066947182650144e-01,
        ],
        [
            7.984632874676697023e-01,
            4.020762706733001512e-01,
            3.910600267933756480e-01,
        ],
        [
            7.959362958998934534e-01,
            3.975481251157440554e-01,
            3.898786646276527490e-01,
        ],
        [
            7.933713473226599033e-01,
            3.930411968130258504e-01,
            3.887608225579017307e-01,
        ],
        [
            7.907686574783574507e-01,
            3.885557303926693296e-01,
            3.877046999689159890e-01,
        ],
        [
            7.881284544156301752e-01,
            3.840919640902587529e-01,
            3.867084595587381712e-01,
        ],
        [
            7.854510012103226302e-01,
            3.796501032751679605e-01,
            3.857702673246294345e-01,
        ],
        [
            7.827365958532629397e-01,
            3.752303177293505598e-01,
            3.848883050999601374e-01,
        ],
        [
            7.799855573279415033e-01,
            3.708327552306592834e-01,
            3.840607581802352732e-01,
        ],
        [
            7.771982233463431422e-01,
            3.664575425267851405e-01,
            3.832858192234025463e-01,
        ],
        [
            7.743749481448563010e-01,
            3.621047863617611329e-01,
            3.825616918198675998e-01,
        ],
        [
            7.715160518337467188e-01,
            3.577746368683014655e-01,
            3.818864831434901075e-01,
        ],
        [
            7.686219524815265380e-01,
            3.534671195520193154e-01,
            3.812584982442814296e-01,
        ],
        [
            7.656930517948008497e-01,
            3.491822750013692245e-01,
            3.806760122706670524e-01,
        ],
        [
            7.627297518608332494e-01,
            3.449201381780978570e-01,
            3.801373059981723590e-01,
        ],
        [
            7.597324610418284552e-01,
            3.406807299395016586e-01,
            3.796406843015277532e-01,
        ],
        [
            7.567015922742318379e-01,
            3.364640582281425152e-01,
            3.791844777860022275e-01,
        ],
        [
            7.536375467881040180e-01,
            3.322701411099439062e-01,
            3.787669970190922220e-01,
        ],
        [
            7.505407196227874556e-01,
            3.280990002753491619e-01,
            3.783865433211569540e-01,
        ],
        [
            7.474115712082280982e-01,
            3.239505493622616417e-01,
            3.780416634360889150e-01,
        ],
        [
            7.442505183508412170e-01,
            3.198247550352249502e-01,
            3.777308063416947026e-01,
        ],
        [
            7.410579750279425726e-01,
            3.157215772518807695e-01,
            3.774524509829353947e-01,
        ],
        [
            7.378343512384677449e-01,
            3.116409704467773545e-01,
            3.772051064266770948e-01,
        ],
        [
            7.345800519344474200e-01,
            3.075828847103421748e-01,
            3.769873118279194468e-01,
        ],
        [
            7.312954622460766663e-01,
            3.035472925968438762e-01,
            3.767975677519167510e-01,
        ],
        [
            7.279809779377566237e-01,
            2.995341347142527755e-01,
            3.766344783074295766e-01,
        ],
        [
            7.246370003939071047e-01,
            2.955433232127043786e-01,
            3.764967560209065978e-01,
        ],
        [
            7.212639047983969709e-01,
            2.915748020657008555e-01,
            3.763830604225979481e-01,
        ],
        [
            7.178620569041518351e-01,
            2.876285169108695472e-01,
            3.762920784118068407e-01,
        ],
        [
            7.144318123927204667e-01,
            2.837044162122266955e-01,
            3.762225233422813453e-01,
        ],
        [
            7.109735162895217675e-01,
            2.798024524280844916e-01,
            3.761731340017399616e-01,
        ],
        [
            7.074875003639726767e-01,
            2.759225885803616163e-01,
            3.761426556123988463e-01,
        ],
        [
            7.039740902088845731e-01,
            2.720647802144139371e-01,
            3.761299015349165442e-01,
        ],
        [
            7.004335983291459788e-01,
            2.682289908573779469e-01,
            3.761337091569335600e-01,
        ],
        [
            6.968663212773178461e-01,
            2.644152012227610760e-01,
            3.761529095527339495e-01,
        ],
        [
            6.932725426766019883e-01,
            2.606234021780075572e-01,
            3.761863526116585033e-01,
        ],
        [
            6.896525329109274294e-01,
            2.568535960113472738e-01,
            3.762329055321002591e-01,
        ],
        [
            6.860065488492232966e-01,
            2.531057977294109973e-01,
            3.762914512548127810e-01,
        ],
        [
            6.823348363761195801e-01,
            2.493800214422073891e-01,
            3.763609500820121467e-01,
        ],
        [
            6.786376242649662105e-01,
            2.456763038128263466e-01,
            3.764403535110733556e-01,
        ],
        [
            6.749151231751110425e-01,
            2.419947210999891518e-01,
            3.765285264384131692e-01,
        ],
        [
            6.711675324616499516e-01,
            2.383353539955441192e-01,
            3.766243994612780699e-01,
        ],
        [
            6.673950369964636309e-01,
            2.346983031289386346e-01,
            3.767269100578239382e-01,
        ],
        [
            6.635978070649097837e-01,
            2.310836906390836831e-01,
            3.768350007100279009e-01,
        ],
        [
            6.597759982863891093e-01,
            2.274916618065601082e-01,
            3.769476169820946132e-01,
        ],
        [
            6.559297473209481089e-01,
            2.239223513030393353e-01,
            3.770639116649144307e-01,
        ],
        [
            6.520591754729223588e-01,
            2.203759654266244650e-01,
            3.771828077558652681e-01,
        ],
        [
            6.481643941443696599e-01,
            2.168527541906234979e-01,
            3.773031206968150975e-01,
        ],
        [
            6.442454984979625321e-01,
            2.133529749202845993e-01,
            3.774237883397635329e-01,
        ],
        [
            6.403025689859566105e-01,
            2.098769174022531714e-01,
            3.775437410683403772e-01,
        ],
        [
            6.363356714241054091e-01,
            2.064249059420060206e-01,
            3.776618996147099727e-01,
        ],
        [
            6.323448551853009247e-01,
            2.029972985879547887e-01,
            3.777771986896097389e-01,
        ],
        [
            6.283301122985771592e-01,
            1.995944416686266654e-01,
            3.778890664877021521e-01,
        ],
        [
            6.242914965761068302e-01,
            1.962168403108488501e-01,
            3.779958773221168133e-01,
        ],
        [
            6.202290151835444521e-01,
            1.928649814733044143e-01,
            3.780964890449534654e-01,
        ],
        [
            6.161426615427991749e-01,
            1.895393981082279800e-01,
            3.781897379927290359e-01,
        ],
        [
            6.120324156302930918e-01,
            1.862406715933664081e-01,
            3.782744366000001524e-01,
        ],
        [
            6.078982443238682976e-01,
            1.829694341941491276e-01,
            3.783493709986866516e-01,
        ],
        [
            6.037399990506459035e-01,
            1.797263486622488471e-01,
            3.784140428470601503e-01,
        ],
        [
            5.995576965897967403e-01,
            1.765121975913181707e-01,
            3.784665259488561584e-01,
        ],
        [
            5.953512720943007208e-01,
            1.733277858871770660e-01,
            3.785054621982753553e-01,
        ],
        [
            5.911206437729070728e-01,
            1.701739770998706713e-01,
            3.785295035265708874e-01,
        ],
        [
            5.868657195674668037e-01,
            1.670516976788867514e-01,
            3.785372630540221883e-01,
        ],
        [
            5.825863435035250060e-01,
            1.639619511220119508e-01,
            3.785276019365447775e-01,
        ],
        [
            5.782823203682633251e-01,
            1.609058321765788335e-01,
            3.784994295515334839e-01,
        ],
        [
            5.739536466014196758e-01,
            1.578844538430557720e-01,
            3.784505787767488694e-01,
        ],
        [
            5.696001981012460691e-01,
            1.548990153349074916e-01,
            3.783794775494400686e-01,
        ],
        [
            5.652218458222221242e-01,
            1.519507861175737884e-01,
            3.782845039525286057e-01,
        ],
        [
            5.608184279263467298e-01,
            1.490411220014642157e-01,
            3.781641038386275300e-01,
        ],
        [
            5.563896048179566289e-01,
            1.461715605343842650e-01,
            3.780173288805740439e-01,
        ],
        [
            5.519354537512982661e-01,
            1.433434802585686063e-01,
            3.778414852793369194e-01,
        ],
        [
            5.474558435278772395e-01,
            1.405584279152288785e-01,
            3.776347269993366451e-01,
        ],
        [
            5.429506470730138812e-01,
            1.378180135121435668e-01,
            3.773951523619960002e-01,
        ],
        [
            5.384196501144510316e-01,
            1.351239813932839096e-01,
            3.771211030874267456e-01,
        ],
        [
            5.338626135422905872e-01,
            1.324781762459926737e-01,
            3.768109124380045194e-01,
        ],
        [
            5.292796498492590151e-01,
            1.298822067930652524e-01,
            3.764618033826110377e-01,
        ],
        [
            5.246706783487381509e-01,
            1.273378756852094063e-01,
            3.760716446399895441e-01,
        ],
        [
            5.200356363922209457e-01,
            1.248470120733735367e-01,
            3.756382551974452033e-01,
        ],
        [
            5.153742367301422656e-01,
            1.224117140591406694e-01,
            3.751600258018771838e-01,
        ],
        [
            5.106866581816573714e-01,
            1.200336468026920456e-01,
            3.746341300161435961e-01,
        ],
        [
            5.059729862980435477e-01,
            1.177145617740232852e-01,
            3.740580772636119544e-01,
        ],
        [
            5.012332745984564575e-01,
            1.154562389937715539e-01,
            3.734295174784395543e-01,
        ],
        [
            4.964674957217509177e-01,
            1.132605442683873864e-01,
            3.727463195168757570e-01,
        ],
        [
            4.916758190194626121e-01,
            1.111290906599490258e-01,
            3.720059818290880060e-01,
        ],
        [
            4.868585609140311798e-01,
            1.090632523851999269e-01,
            3.712058226357082269e-01,
        ],
        [
            4.820159589014604840e-01,
            1.070644243738244350e-01,
            3.703434438399521023e-01,
        ],
        [
            4.771482837998479165e-01,
            1.051338742417683159e-01,
            3.694164970204523168e-01,
        ],
        [
            4.722559296975721854e-01,
            1.032725993184717139e-01,
            3.684225499867860298e-01,
        ],
        [
            4.673393879073711177e-01,
            1.014813305146687883e-01,
            3.673591735272957459e-01,
        ],
        [
            4.623991454541829804e-01,
            9.976065343840129218e-02,
            3.662241176536292220e-01,
        ],
        [
            4.574358041489324234e-01,
            9.811082191626963045e-02,
            3.650151416090168244e-01,
        ],
        [
            4.524502157463570762e-01,
            9.653152558968838837e-02,
            3.637298817526759542e-01,
        ],
        [
            4.474429556959144683e-01,
            9.502266265951053725e-02,
            3.623665563347658880e-01,
        ],
        [
            4.424148033564082039e-01,
            9.358361785401031474e-02,
            3.609233190012756665e-01,
        ],
        [
            4.373666093617918915e-01,
            9.221344371517425920e-02,
            3.593984619211612608e-01,
        ],
        [
            4.323000061476657274e-01,
            9.090969474799345806e-02,
            3.577897503619592023e-01,
        ],
        [
            4.272154852828886629e-01,
            8.967151542383772211e-02,
            3.560963875772367726e-01,
        ],
        [
            4.221140984792258188e-01,
            8.849693359303587026e-02,
            3.543172112905775273e-01,
        ],
        [
            4.169969758462759302e-01,
            8.738362154375492463e-02,
            3.524512375858371849e-01,
        ],
        [
            4.118658301965831270e-01,
            8.632803919827600203e-02,
            3.504973239811765007e-01,
        ],
        [
            4.067221669675408213e-01,
            8.532676500724681312e-02,
            3.484548346345710534e-01,
        ],
        [
            4.015666852977432533e-01,
            8.437757766440442952e-02,
            3.463238990387739746e-01,
        ],
        [
            3.964007130297593218e-01,
            8.347701754004596686e-02,
            3.441044235724556866e-01,
        ],
        [
            3.912256097683191602e-01,
            8.262141527259461715e-02,
            3.417965388380971303e-01,
        ],
        [
            3.860430941874281596e-01,
            8.180633277581816909e-02,
            3.394004639140563162e-01,
        ],
        [
            3.808555339288969832e-01,
            8.102605665725876039e-02,
            3.369164884312597086e-01,
        ],
        [
            3.756631594887540060e-01,
            8.027857713191724476e-02,
            3.343459517649038371e-01,
        ],
        [
            3.704673590324250032e-01,
            7.955977986332424257e-02,
            3.316898655204278401e-01,
        ],
        [
            3.652695090362573227e-01,
            7.886552703397090025e-02,
            3.289494343067977944e-01,
        ],
        [
            3.600709660701238435e-01,
            7.819169210462800779e-02,
            3.261260438198446687e-01,
        ],
        [
            3.548730588141333908e-01,
            7.753419260275734581e-02,
            3.232212473818363851e-01,
        ],
        [
            3.496770804198256477e-01,
            7.688902041627435069e-02,
            3.202367511798585031e-01,
        ],
        [
            3.444853557545813350e-01,
            7.625034119537774102e-02,
            3.171743822649770728e-01,
        ],
        [
            3.392982604990861795e-01,
            7.561586038621423422e-02,
            3.140362188799208365e-01,
        ],
        [
            3.341166082970875029e-01,
            7.498254313274954619e-02,
            3.108243324765390669e-01,
        ],
        [
            3.289414559917514524e-01,
            7.434697155739058982e-02,
            3.075408588184366798e-01,
        ],
        [
            3.237737954171283072e-01,
            7.370590341662106026e-02,
            3.041879989569576392e-01,
        ],
        [
            3.186145498482620964e-01,
            7.305628171756148315e-02,
            3.007680026557595920e-01,
        ],
        [
            3.134645711821229530e-01,
            7.239524117563511663e-02,
            2.972831523530131137e-01,
        ],
        [
            3.083246378402036969e-01,
            7.172011173017686647e-02,
            2.937357478389135412e-01,
        ],
        [
            3.031954533707552635e-01,
            7.102841937235576664e-02,
            2.901280917978547591e-01,
        ],
        [
            2.980776457172774063e-01,
            7.031788456468926474e-02,
            2.864624763353166292e-01,
        ],
        [
            2.929717671102379239e-01,
            6.958641854495320467e-02,
            2.827411705802333475e-01,
        ],
        [
            2.878782945311796904e-01,
            6.883211781082057557e-02,
            2.789664094251954607e-01,
        ],
        [
            2.827976306923836725e-01,
            6.805325707674123037e-02,
            2.751403834400568682e-01,
        ],
        [
            2.777301054710668571e-01,
            6.724828098296936618e-02,
            2.712652299698696257e-01,
        ],
        [
            2.726759777346169922e-01,
            6.641579481976991883e-02,
            2.673430254060571443e-01,
        ],
        [
            2.676354374924288515e-01,
            6.555455450916861104e-02,
            2.633757786005420098e-01,
        ],
        [
            2.626097591395918363e-01,
            6.466149844681601255e-02,
            2.593660533804174051e-01,
        ],
        [
            2.575992689989206608e-01,
            6.373522644476575794e-02,
            2.553159580518031269e-01,
        ],
        [
            2.526028775756383737e-01,
            6.277674824557366584e-02,
            2.512267303676423147e-01,
        ],
        [
            2.476205211412589313e-01,
            6.178532806314660647e-02,
            2.471000835041496368e-01,
        ],
        [
            2.426520784951842757e-01,
            6.076032925135082391e-02,
            2.429376426307544024e-01,
        ],
        [
            2.376973739685813714e-01,
            5.970120319443159712e-02,
            2.387409437758167274e-01,
        ],
        [
            2.327561803770203386e-01,
            5.860747847771281133e-02,
            2.345114333677875140e-01,
        ],
        [
            2.278285229664566147e-01,
            5.747825339035907838e-02,
            2.302506881609430733e-01,
        ],
        [
            2.229180662380075839e-01,
            5.630663136815370479e-02,
            2.259630047830259447e-01,
        ],
        [
            2.180204522985965676e-01,
            5.509893160286010588e-02,
            2.216467626153181270e-01,
        ],
        [
            2.131352588343927157e-01,
            5.385491895770589538e-02,
            2.173030574920574165e-01,
        ],
        [
            2.082620235717315138e-01,
            5.257438772048273617e-02,
            2.129328977906284059e-01,
        ],
        [
            2.034002463374002811e-01,
            5.125715285178860520e-02,
            2.085372063771265272e-01,
        ],
    ]
    return _cmap("linear_curl", cm_data, reverse=reverse)


def cmap_linear_bgyw(reverse=False):
    # https://github.com/pyviz/colorcet
    # linear colormap, perceptually uniform
    cm_data = [
        [0.10477, 0.0011197, 0.51875],
        [0.105, 0.0031206, 0.52587],
        [0.10521, 0.005201, 0.53301],
        [0.10541, 0.0074297, 0.5401],
        [0.10559, 0.0097752, 0.54718],
        [0.10576, 0.012459, 0.55425],
        [0.10592, 0.015073, 0.56126],
        [0.10605, 0.017812, 0.56829],
        [0.10619, 0.020743, 0.57524],
        [0.10631, 0.023778, 0.5822],
        [0.10643, 0.027021, 0.58909],
        [0.10653, 0.030386, 0.59599],
        [0.10663, 0.033922, 0.60282],
        [0.10672, 0.037861, 0.60963],
        [0.10682, 0.041783, 0.6164],
        [0.10691, 0.045535, 0.62314],
        [0.107, 0.049457, 0.62982],
        [0.10709, 0.053176, 0.63647],
        [0.10718, 0.057025, 0.64308],
        [0.10728, 0.060795, 0.64963],
        [0.10738, 0.064591, 0.65615],
        [0.1075, 0.068417, 0.6626],
        [0.10762, 0.072133, 0.66902],
        [0.10776, 0.075909, 0.67536],
        [0.10791, 0.079695, 0.68166],
        [0.10808, 0.08353, 0.6879],
        [0.10826, 0.087375, 0.69408],
        [0.10848, 0.091188, 0.7002],
        [0.10873, 0.095035, 0.70626],
        [0.10901, 0.098847, 0.71224],
        [0.10933, 0.10273, 0.71815],
        [0.10965, 0.10666, 0.724],
        [0.11, 0.11057, 0.72975],
        [0.11035, 0.11443, 0.73545],
        [0.11077, 0.11848, 0.74103],
        [0.11121, 0.1224, 0.74656],
        [0.11171, 0.12647, 0.75198],
        [0.11224, 0.13056, 0.75731],
        [0.11282, 0.13464, 0.76255],
        [0.11344, 0.13874, 0.76767],
        [0.11404, 0.14289, 0.77271],
        [0.11474, 0.14709, 0.77762],
        [0.11555, 0.15131, 0.78241],
        [0.11637, 0.1556, 0.78711],
        [0.11721, 0.15989, 0.79164],
        [0.11817, 0.16429, 0.79606],
        [0.11913, 0.16868, 0.80035],
        [0.12014, 0.17313, 0.80446],
        [0.12122, 0.17766, 0.80845],
        [0.12236, 0.18216, 0.81227],
        [0.12358, 0.1868, 0.8159],
        [0.12487, 0.19146, 0.81936],
        [0.12621, 0.19619, 0.82267],
        [0.12758, 0.20095, 0.82573],
        [0.12902, 0.20585, 0.82858],
        [0.13057, 0.21075, 0.83123],
        [0.13209, 0.21574, 0.83365],
        [0.1337, 0.22083, 0.83579],
        [0.13536, 0.22598, 0.83764],
        [0.13708, 0.23121, 0.83921],
        [0.13882, 0.23653, 0.84047],
        [0.14063, 0.24194, 0.84141],
        [0.14244, 0.24745, 0.84198],
        [0.1443, 0.25307, 0.84216],
        [0.14616, 0.25882, 0.84191],
        [0.14804, 0.26468, 0.84117],
        [0.14995, 0.27071, 0.8399],
        [0.15179, 0.27687, 0.83804],
        [0.15363, 0.2832, 0.83552],
        [0.15544, 0.28972, 0.83227],
        [0.15711, 0.29645, 0.82819],
        [0.1587, 0.30339, 0.82319],
        [0.16004, 0.31064, 0.81705],
        [0.16121, 0.31816, 0.80955],
        [0.16198, 0.32608, 0.80043],
        [0.16232, 0.33446, 0.78944],
        [0.16261, 0.34288, 0.77734],
        [0.16339, 0.351, 0.7652],
        [0.16458, 0.35878, 0.75318],
        [0.16618, 0.3663, 0.7413],
        [0.16813, 0.37354, 0.72954],
        [0.17035, 0.38056, 0.71789],
        [0.1728, 0.38735, 0.70636],
        [0.17542, 0.39397, 0.69491],
        [0.17821, 0.40042, 0.68357],
        [0.18104, 0.40669, 0.67233],
        [0.18398, 0.41284, 0.66117],
        [0.18698, 0.41883, 0.65009],
        [0.19, 0.42472, 0.6391],
        [0.19303, 0.43049, 0.62818],
        [0.19608, 0.43615, 0.61732],
        [0.19905, 0.44173, 0.60653],
        [0.20205, 0.4472, 0.59581],
        [0.20503, 0.45261, 0.58515],
        [0.20793, 0.45792, 0.57453],
        [0.2108, 0.46316, 0.56398],
        [0.21364, 0.46835, 0.55345],
        [0.21643, 0.47347, 0.54299],
        [0.21913, 0.47854, 0.53255],
        [0.22179, 0.48354, 0.52214],
        [0.22439, 0.4885, 0.51178],
        [0.22697, 0.4934, 0.50144],
        [0.22945, 0.49828, 0.49112],
        [0.23194, 0.50308, 0.48079],
        [0.23434, 0.50787, 0.47051],
        [0.23669, 0.5126, 0.4602],
        [0.23896, 0.51731, 0.44992],
        [0.24122, 0.52197, 0.43962],
        [0.24342, 0.52661, 0.42932],
        [0.2456, 0.53121, 0.419],
        [0.24776, 0.53578, 0.40865],
        [0.24982, 0.54033, 0.39827],
        [0.2519, 0.54485, 0.38784],
        [0.25394, 0.54933, 0.37747],
        [0.25603, 0.55376, 0.36733],
        [0.25825, 0.55813, 0.35754],
        [0.26059, 0.56246, 0.34801],
        [0.26305, 0.56672, 0.33878],
        [0.26563, 0.57092, 0.32981],
        [0.26835, 0.57509, 0.32108],
        [0.27123, 0.57921, 0.31258],
        [0.27426, 0.58328, 0.30433],
        [0.27745, 0.58731, 0.29629],
        [0.28078, 0.5913, 0.28844],
        [0.28431, 0.59525, 0.28077],
        [0.28799, 0.59916, 0.27333],
        [0.29185, 0.60303, 0.26603],
        [0.29585, 0.60687, 0.2589],
        [0.30003, 0.61067, 0.25192],
        [0.30437, 0.61442, 0.24507],
        [0.3089, 0.61816, 0.23841],
        [0.31357, 0.62185, 0.23192],
        [0.3184, 0.62552, 0.22553],
        [0.32339, 0.62915, 0.21927],
        [0.32852, 0.63275, 0.21311],
        [0.3338, 0.63632, 0.20712],
        [0.33922, 0.63986, 0.20117],
        [0.34475, 0.64337, 0.19538],
        [0.35045, 0.64686, 0.1897],
        [0.35629, 0.6503, 0.18415],
        [0.36225, 0.65372, 0.17872],
        [0.36834, 0.65712, 0.17336],
        [0.37454, 0.66048, 0.1681],
        [0.38085, 0.66383, 0.16297],
        [0.38726, 0.66714, 0.15793],
        [0.39382, 0.67043, 0.15302],
        [0.40049, 0.67368, 0.14824],
        [0.40723, 0.67691, 0.14356],
        [0.41408, 0.68011, 0.13895],
        [0.42102, 0.68329, 0.13455],
        [0.42809, 0.68644, 0.13028],
        [0.43524, 0.68956, 0.12609],
        [0.44246, 0.69267, 0.12198],
        [0.44975, 0.69574, 0.11813],
        [0.45716, 0.69877, 0.1144],
        [0.46465, 0.70179, 0.11092],
        [0.4722, 0.70479, 0.10752],
        [0.47982, 0.70776, 0.1043],
        [0.48754, 0.7107, 0.1014],
        [0.49532, 0.71361, 0.098689],
        [0.50314, 0.7165, 0.096121],
        [0.51106, 0.71936, 0.093905],
        [0.51907, 0.72219, 0.091988],
        [0.52711, 0.72501, 0.090242],
        [0.53519, 0.72779, 0.08877],
        [0.54339, 0.73055, 0.087727],
        [0.55162, 0.73328, 0.086928],
        [0.5599, 0.73598, 0.086341],
        [0.56824, 0.73866, 0.086171],
        [0.57666, 0.74131, 0.086363],
        [0.58511, 0.74394, 0.086854],
        [0.59362, 0.74654, 0.087647],
        [0.60218, 0.74911, 0.088756],
        [0.61075, 0.75167, 0.090091],
        [0.6193, 0.75421, 0.091662],
        [0.62776, 0.75676, 0.093291],
        [0.63618, 0.7593, 0.095179],
        [0.64452, 0.76186, 0.097055],
        [0.65279, 0.76442, 0.0992],
        [0.66101, 0.76698, 0.10144],
        [0.66917, 0.76954, 0.10382],
        [0.67726, 0.77211, 0.10635],
        [0.68528, 0.77468, 0.10898],
        [0.69324, 0.77727, 0.11176],
        [0.70115, 0.77985, 0.1146],
        [0.70899, 0.78245, 0.11768],
        [0.71675, 0.78505, 0.12084],
        [0.72446, 0.78766, 0.12415],
        [0.73211, 0.79027, 0.12759],
        [0.73969, 0.7929, 0.13116],
        [0.74719, 0.79554, 0.13488],
        [0.75463, 0.79819, 0.13869],
        [0.762, 0.80085, 0.14265],
        [0.76931, 0.80352, 0.1467],
        [0.77655, 0.80621, 0.15091],
        [0.78371, 0.80891, 0.15527],
        [0.79078, 0.81163, 0.15974],
        [0.79778, 0.81436, 0.1644],
        [0.80471, 0.81711, 0.16917],
        [0.81155, 0.81987, 0.17404],
        [0.8183, 0.82266, 0.17908],
        [0.82496, 0.82547, 0.18425],
        [0.83154, 0.8283, 0.18958],
        [0.83802, 0.83116, 0.19506],
        [0.84439, 0.83404, 0.20068],
        [0.85066, 0.83694, 0.20653],
        [0.85681, 0.83988, 0.21248],
        [0.86285, 0.84285, 0.21864],
        [0.86877, 0.84585, 0.22495],
        [0.87454, 0.84889, 0.23152],
        [0.88018, 0.85196, 0.23823],
        [0.88567, 0.85508, 0.24516],
        [0.89101, 0.85823, 0.25235],
        [0.89617, 0.86144, 0.25975],
        [0.90116, 0.86469, 0.26737],
        [0.90596, 0.868, 0.27529],
        [0.91052, 0.87137, 0.2835],
        [0.91485, 0.87481, 0.29203],
        [0.91894, 0.87831, 0.30086],
        [0.92276, 0.88189, 0.31007],
        [0.92625, 0.88556, 0.3197],
        [0.92941, 0.88931, 0.32973],
        [0.93217, 0.89317, 0.34027],
        [0.93451, 0.89714, 0.3513],
        [0.93634, 0.90125, 0.36298],
        [0.93763, 0.9055, 0.37534],
        [0.9387, 0.90978, 0.38837],
        [0.93989, 0.91399, 0.40197],
        [0.94123, 0.91811, 0.41613],
        [0.94272, 0.92216, 0.43083],
        [0.94436, 0.92612, 0.44608],
        [0.94613, 0.93, 0.46186],
        [0.94803, 0.9338, 0.47813],
        [0.95005, 0.93753, 0.49497],
        [0.95218, 0.94117, 0.5123],
        [0.95441, 0.94474, 0.53014],
        [0.95674, 0.94822, 0.54852],
        [0.95915, 0.95163, 0.56741],
        [0.96162, 0.95496, 0.58679],
        [0.96415, 0.95822, 0.60671],
        [0.96673, 0.96139, 0.62717],
        [0.96934, 0.96449, 0.64813],
        [0.97196, 0.96752, 0.66962],
        [0.97459, 0.97046, 0.69168],
        [0.97722, 0.97333, 0.71425],
        [0.9798, 0.97613, 0.73736],
        [0.98235, 0.97885, 0.76105],
        [0.98483, 0.98151, 0.78529],
        [0.98722, 0.98408, 0.81007],
        [0.98952, 0.98658, 0.83544],
        [0.99169, 0.98901, 0.8614],
        [0.99371, 0.99136, 0.88792],
        [0.99556, 0.99365, 0.91503],
        [0.99723, 0.99585, 0.94278],
        [0.99867, 0.99799, 0.97109],
        [0.99986, 1, 1],
    ]
    return _cmap("linear_bgyw", cm_data, reverse=reverse)


def cmap_linear_bgy(reverse=False):
    # https://github.com/pyviz/colorcet
    # linear colormap, perceptually uniform
    cm_data = [
        [0, 0.047803, 0.4883],
        [0, 0.049756, 0.49556],
        [0, 0.051605, 0.50281],
        [0, 0.053545, 0.51004],
        [0, 0.055585, 0.51721],
        [0, 0.057566, 0.52435],
        [0, 0.05978, 0.53144],
        [0, 0.061812, 0.53849],
        [0, 0.064016, 0.5455],
        [0, 0.066232, 0.55245],
        [0, 0.068551, 0.55934],
        [0, 0.070824, 0.5662],
        [0, 0.073229, 0.57299],
        [0, 0.07557, 0.57971],
        [0, 0.078003, 0.58638],
        [0, 0.080554, 0.59299],
        [0, 0.083114, 0.59951],
        [0, 0.085697, 0.60596],
        [0, 0.08842, 0.61236],
        [0, 0.091168, 0.61866],
        [0, 0.093925, 0.62487],
        [0, 0.096707, 0.63101],
        [0, 0.09963, 0.63705],
        [0, 0.1026, 0.64298],
        [0, 0.10561, 0.64881],
        [0, 0.10866, 0.65454],
        [0, 0.11183, 0.66016],
        [0, 0.11497, 0.66567],
        [0, 0.11829, 0.67103],
        [0, 0.12156, 0.67626],
        [0, 0.12498, 0.68134],
        [0, 0.12846, 0.68629],
        [0, 0.13201, 0.69107],
        [0, 0.13559, 0.6957],
        [0, 0.13927, 0.70014],
        [0, 0.14307, 0.70439],
        [0, 0.1469, 0.70845],
        [0, 0.15085, 0.71227],
        [0, 0.15487, 0.71588],
        [0, 0.159, 0.71923],
        [0, 0.16323, 0.7223],
        [0, 0.16754, 0.7251],
        [0, 0.17195, 0.72757],
        [0, 0.17647, 0.72972],
        [0, 0.18113, 0.73149],
        [0, 0.18594, 0.73289],
        [0, 0.19074, 0.73398],
        [0, 0.19556, 0.73486],
        [0, 0.20033, 0.73556],
        [0, 0.20512, 0.73608],
        [0, 0.20987, 0.73643],
        [0, 0.21461, 0.73659],
        [0, 0.21934, 0.73657],
        [0, 0.22402, 0.73637],
        [0, 0.22875, 0.73599],
        [0, 0.2334, 0.73544],
        [0, 0.23809, 0.73469],
        [0, 0.24275, 0.73376],
        [0, 0.24743, 0.73266],
        [0, 0.25208, 0.73137],
        [0, 0.25673, 0.72991],
        [0, 0.26137, 0.72825],
        [0, 0.26603, 0.72642],
        [0, 0.27068, 0.72441],
        [0, 0.27531, 0.72221],
        [0, 0.27995, 0.71983],
        [0, 0.28458, 0.71727],
        [0, 0.28924, 0.71452],
        [0, 0.29387, 0.71161],
        [0, 0.29852, 0.70851],
        [0, 0.30317, 0.70521],
        [0, 0.30782, 0.70174],
        [0, 0.31248, 0.69809],
        [0, 0.31716, 0.69426],
        [0, 0.32182, 0.69025],
        [0, 0.32649, 0.68607],
        [0, 0.33116, 0.68178],
        [0, 0.33582, 0.67746],
        [0, 0.34046, 0.6731],
        [0, 0.34509, 0.66871],
        [0, 0.3497, 0.66429],
        [0, 0.3543, 0.65984],
        [0, 0.35888, 0.65536],
        [0, 0.36346, 0.65085],
        [0, 0.36803, 0.6463],
        [0, 0.37258, 0.64173],
        [0, 0.37713, 0.63713],
        [0, 0.38167, 0.6325],
        [0, 0.38618, 0.62783],
        [0, 0.39071, 0.62313],
        [0, 0.39523, 0.6184],
        [0, 0.39972, 0.61363],
        [0, 0.40423, 0.60885],
        [0, 0.40872, 0.60402],
        [0, 0.41321, 0.59915],
        [0, 0.41769, 0.59426],
        [0, 0.42215, 0.58932],
        [0, 0.42663, 0.58437],
        [0, 0.4311, 0.57937],
        [0, 0.43556, 0.57433],
        [0, 0.44001, 0.56926],
        [0, 0.44446, 0.56416],
        [0, 0.44891, 0.55902],
        [0, 0.45334, 0.55384],
        [0, 0.45778, 0.54863],
        [0, 0.46222, 0.54336],
        [0, 0.46665, 0.53802],
        [0, 0.47105, 0.53253],
        [0, 0.47545, 0.52691],
        [0, 0.47982, 0.52115],
        [0, 0.48417, 0.51525],
        [0, 0.48852, 0.50921],
        [0, 0.49284, 0.50301],
        [0, 0.49717, 0.49668],
        [0, 0.50147, 0.49022],
        [0, 0.50575, 0.48359],
        [0, 0.51003, 0.47682],
        [0, 0.51431, 0.4699],
        [0, 0.51856, 0.4628],
        [0.0097866, 0.52281, 0.45558],
        [0.023896, 0.52704, 0.44818],
        [0.038383, 0.53126, 0.44061],
        [0.051763, 0.53547, 0.43289],
        [0.063442, 0.53968, 0.42499],
        [0.073828, 0.54388, 0.41692],
        [0.083244, 0.54807, 0.40866],
        [0.092062, 0.55225, 0.40022],
        [0.10019, 0.55642, 0.39159],
        [0.10786, 0.56059, 0.38276],
        [0.11513, 0.56474, 0.37372],
        [0.12206, 0.56889, 0.36445],
        [0.12871, 0.57304, 0.35498],
        [0.13507, 0.57718, 0.34524],
        [0.14115, 0.58131, 0.33527],
        [0.14697, 0.58544, 0.32499],
        [0.15257, 0.58954, 0.31449],
        [0.15773, 0.59367, 0.30393],
        [0.16231, 0.59779, 0.29352],
        [0.16631, 0.60191, 0.28332],
        [0.16984, 0.60603, 0.27332],
        [0.17292, 0.61015, 0.26352],
        [0.17565, 0.61427, 0.25387],
        [0.17811, 0.6184, 0.24439],
        [0.18021, 0.62252, 0.23514],
        [0.18207, 0.62664, 0.22606],
        [0.18374, 0.63076, 0.21715],
        [0.18522, 0.63487, 0.2084],
        [0.18649, 0.63898, 0.19982],
        [0.18765, 0.64309, 0.19148],
        [0.18863, 0.6472, 0.18334],
        [0.18951, 0.6513, 0.1754],
        [0.19029, 0.65539, 0.16767],
        [0.19099, 0.65948, 0.16013],
        [0.19162, 0.66357, 0.15293],
        [0.19219, 0.66765, 0.14604],
        [0.19272, 0.67172, 0.13937],
        [0.1932, 0.67579, 0.13311],
        [0.19366, 0.67985, 0.1272],
        [0.1941, 0.68391, 0.1218],
        [0.19451, 0.68797, 0.11692],
        [0.1949, 0.69202, 0.11259],
        [0.19529, 0.69606, 0.10881],
        [0.19569, 0.70009, 0.10581],
        [0.19611, 0.70412, 0.10358],
        [0.19653, 0.70814, 0.10209],
        [0.19694, 0.71215, 0.10139],
        [0.19736, 0.71617, 0.10116],
        [0.19779, 0.72018, 0.10101],
        [0.19823, 0.7242, 0.10087],
        [0.19868, 0.72822, 0.10073],
        [0.19914, 0.73225, 0.1006],
        [0.19961, 0.73627, 0.10048],
        [0.20009, 0.74031, 0.10036],
        [0.20058, 0.74434, 0.10025],
        [0.20108, 0.74838, 0.10015],
        [0.20159, 0.75242, 0.10006],
        [0.20211, 0.75647, 0.099977],
        [0.20265, 0.76052, 0.099902],
        [0.2032, 0.76457, 0.099835],
        [0.20376, 0.76862, 0.099777],
        [0.20433, 0.77267, 0.099729],
        [0.20488, 0.77674, 0.099691],
        [0.20546, 0.7808, 0.099663],
        [0.20608, 0.78487, 0.099645],
        [0.20669, 0.78894, 0.099637],
        [0.20729, 0.79301, 0.099641],
        [0.20791, 0.79708, 0.099656],
        [0.20855, 0.80116, 0.099683],
        [0.2092, 0.80523, 0.09972],
        [0.20987, 0.80932, 0.09977],
        [0.21055, 0.8134, 0.099833],
        [0.21125, 0.81749, 0.099908],
        [0.21196, 0.82159, 0.099996],
        [0.21266, 0.82567, 0.1001],
        [0.2134, 0.82977, 0.10021],
        [0.21454, 0.83386, 0.10034],
        [0.21746, 0.83784, 0.10049],
        [0.22334, 0.84166, 0.10065],
        [0.23182, 0.84531, 0.10083],
        [0.24228, 0.84884, 0.10102],
        [0.25428, 0.85224, 0.10123],
        [0.26735, 0.85553, 0.10145],
        [0.28125, 0.85872, 0.10168],
        [0.29571, 0.86184, 0.10193],
        [0.31067, 0.86485, 0.10219],
        [0.32594, 0.86779, 0.10246],
        [0.34137, 0.87065, 0.10275],
        [0.35684, 0.87346, 0.10306],
        [0.3724, 0.87619, 0.10337],
        [0.38805, 0.87886, 0.10369],
        [0.40366, 0.88147, 0.10401],
        [0.41921, 0.88402, 0.10433],
        [0.43478, 0.88651, 0.10468],
        [0.45028, 0.88894, 0.10507],
        [0.4657, 0.89133, 0.10549],
        [0.48111, 0.89365, 0.10592],
        [0.49641, 0.89593, 0.10637],
        [0.51169, 0.89815, 0.10681],
        [0.52691, 0.90032, 0.10725],
        [0.54202, 0.90245, 0.1077],
        [0.55713, 0.90452, 0.10817],
        [0.57212, 0.90655, 0.10869],
        [0.5871, 0.90852, 0.10927],
        [0.60201, 0.91045, 0.10983],
        [0.61689, 0.91232, 0.11037],
        [0.63169, 0.91415, 0.11095],
        [0.64646, 0.91593, 0.11155],
        [0.66118, 0.91767, 0.11216],
        [0.67585, 0.91934, 0.11281],
        [0.69049, 0.92098, 0.11347],
        [0.70508, 0.92257, 0.11409],
        [0.71966, 0.92411, 0.11477],
        [0.73418, 0.9256, 0.11552],
        [0.74868, 0.92704, 0.11627],
        [0.76314, 0.92844, 0.11699],
        [0.77759, 0.92979, 0.11777],
        [0.79201, 0.93109, 0.11859],
        [0.8064, 0.93233, 0.11937],
        [0.82077, 0.93353, 0.12019],
        [0.83511, 0.93468, 0.12102],
        [0.84946, 0.93578, 0.12189],
        [0.86375, 0.93684, 0.12278],
        [0.87808, 0.93783, 0.1237],
        [0.89234, 0.93878, 0.12464],
        [0.90664, 0.93968, 0.12562],
        [0.92088, 0.94052, 0.12657],
        [0.93514, 0.94131, 0.12755],
        [0.94939, 0.94206, 0.12857],
        [0.9636, 0.94275, 0.12961],
        [0.97785, 0.94338, 0.13068],
        [0.99205, 0.94397, 0.13172],
        [1, 0.94449, 0.13281],
        [1, 0.94497, 0.13392],
        [1, 0.94539, 0.13505],
        [1, 0.94574, 0.13614],
        [1, 0.94606, 0.13735],
    ]
    return _cmap("linear_bgy", cm_data, reverse=reverse)


def cmap_linear_rainbow(reverse=False):
    # https://github.com/pyviz/colorcet
    # linear colormap, perceptually uniform
    cm_data = [
        [0, 0.20755, 0.97632],
        [0, 0.21857, 0.96476],
        [0, 0.2291, 0.95322],
        [0, 0.23923, 0.94169],
        [0, 0.24899, 0.93018],
        [0, 0.25842, 0.91868],
        [0, 0.26756, 0.9072],
        [0, 0.27649, 0.89573],
        [0, 0.28513, 0.88428],
        [0, 0.29358, 0.87284],
        [0, 0.30184, 0.86141],
        [0, 0.30994, 0.85],
        [0, 0.31785, 0.83859],
        [0, 0.3256, 0.82721],
        [0, 0.33324, 0.81583],
        [0, 0.34073, 0.80447],
        [0, 0.3481, 0.79312],
        [0, 0.35537, 0.78178],
        [0, 0.3625, 0.77045],
        [0, 0.36954, 0.75913],
        [0, 0.37649, 0.74783],
        [0, 0.38333, 0.73654],
        [0, 0.39005, 0.72528],
        [0, 0.39667, 0.71405],
        [0, 0.40319, 0.70286],
        [0, 0.40957, 0.69171],
        [0, 0.4158, 0.68063],
        [0, 0.42188, 0.66965],
        [0, 0.4278, 0.65875],
        [0, 0.43352, 0.64799],
        [0, 0.43905, 0.63737],
        [0, 0.44438, 0.62689],
        [0, 0.4495, 0.61659],
        [0, 0.45441, 0.60644],
        [0, 0.45914, 0.59646],
        [0.0019224, 0.46368, 0.58662],
        [0.027932, 0.46808, 0.57693],
        [0.054843, 0.47236, 0.56735],
        [0.076598, 0.47653, 0.55785],
        [0.095053, 0.48062, 0.54844],
        [0.11106, 0.48465, 0.53907],
        [0.12523, 0.48865, 0.52974],
        [0.13795, 0.49262, 0.52042],
        [0.14935, 0.49658, 0.5111],
        [0.15962, 0.50055, 0.50179],
        [0.169, 0.50452, 0.49245],
        [0.17747, 0.50849, 0.48309],
        [0.18517, 0.51246, 0.4737],
        [0.19217, 0.51645, 0.46429],
        [0.19856, 0.52046, 0.45483],
        [0.20443, 0.52448, 0.44531],
        [0.20974, 0.52851, 0.43577],
        [0.21461, 0.53255, 0.42616],
        [0.21905, 0.53661, 0.41651],
        [0.22309, 0.54066, 0.40679],
        [0.22674, 0.54474, 0.397],
        [0.23002, 0.54883, 0.38713],
        [0.233, 0.55292, 0.3772],
        [0.23568, 0.55703, 0.36716],
        [0.23802, 0.56114, 0.35704],
        [0.24006, 0.56526, 0.34678],
        [0.24185, 0.56939, 0.3364],
        [0.24334, 0.57354, 0.32588],
        [0.24458, 0.57769, 0.31523],
        [0.24556, 0.58185, 0.30439],
        [0.2463, 0.58603, 0.29336],
        [0.2468, 0.59019, 0.28214],
        [0.24707, 0.59438, 0.27067],
        [0.24714, 0.59856, 0.25895],
        [0.24704, 0.60275, 0.24696],
        [0.24679, 0.60693, 0.23472],
        [0.24648, 0.61109, 0.22215],
        [0.24616, 0.61523, 0.20933],
        [0.24597, 0.61936, 0.19628],
        [0.24602, 0.62342, 0.18297],
        [0.24648, 0.62742, 0.1696],
        [0.24753, 0.63135, 0.15615],
        [0.24931, 0.63518, 0.14276],
        [0.25204, 0.63889, 0.12965],
        [0.25579, 0.64249, 0.11693],
        [0.2607, 0.64593, 0.10484],
        [0.26674, 0.64925, 0.093668],
        [0.2739, 0.65241, 0.083583],
        [0.28205, 0.65544, 0.074764],
        [0.29104, 0.65834, 0.067449],
        [0.30071, 0.66112, 0.061598],
        [0.31093, 0.66382, 0.057362],
        [0.32147, 0.66641, 0.054542],
        [0.33226, 0.66895, 0.052918],
        [0.34314, 0.67142, 0.052293],
        [0.35402, 0.67386, 0.052401],
        [0.36487, 0.67627, 0.05303],
        [0.37564, 0.67864, 0.054018],
        [0.38629, 0.681, 0.055243],
        [0.39683, 0.68335, 0.05664],
        [0.40725, 0.68569, 0.057955],
        [0.41755, 0.68801, 0.059542],
        [0.42772, 0.69031, 0.060911],
        [0.43777, 0.69262, 0.062454],
        [0.4477, 0.69491, 0.063883],
        [0.45755, 0.69719, 0.065334],
        [0.46731, 0.69947, 0.066802],
        [0.47698, 0.70173, 0.068291],
        [0.48656, 0.70399, 0.069758],
        [0.49607, 0.70625, 0.071211],
        [0.50551, 0.70848, 0.072621],
        [0.5149, 0.71071, 0.074107],
        [0.52421, 0.71293, 0.07551],
        [0.53346, 0.71514, 0.076938],
        [0.54268, 0.71735, 0.078389],
        [0.55183, 0.71954, 0.079862],
        [0.56093, 0.72172, 0.08136],
        [0.56998, 0.7239, 0.082779],
        [0.57901, 0.72607, 0.084273],
        [0.58797, 0.72822, 0.08563],
        [0.59692, 0.73037, 0.08717],
        [0.60581, 0.73251, 0.088583],
        [0.61468, 0.73464, 0.09003],
        [0.62353, 0.73676, 0.091506],
        [0.63233, 0.73887, 0.092872],
        [0.6411, 0.74097, 0.094388],
        [0.64986, 0.74307, 0.095796],
        [0.65858, 0.74515, 0.097234],
        [0.66728, 0.74722, 0.098697],
        [0.67595, 0.74928, 0.10013],
        [0.6846, 0.75135, 0.10157],
        [0.69324, 0.75339, 0.10305],
        [0.70185, 0.75543, 0.10444],
        [0.71045, 0.75746, 0.10594],
        [0.71902, 0.75947, 0.10738],
        [0.72758, 0.76149, 0.10881],
        [0.73613, 0.76349, 0.1103],
        [0.74466, 0.76548, 0.11173],
        [0.75317, 0.76746, 0.1132],
        [0.76167, 0.76943, 0.11457],
        [0.77016, 0.7714, 0.11608],
        [0.77864, 0.77335, 0.11749],
        [0.78711, 0.7753, 0.11897],
        [0.79556, 0.77724, 0.12038],
        [0.80401, 0.77916, 0.12182],
        [0.81244, 0.78108, 0.12327],
        [0.82086, 0.78299, 0.12474],
        [0.82929, 0.78489, 0.12623],
        [0.83769, 0.78678, 0.12766],
        [0.84609, 0.78866, 0.1291],
        [0.8545, 0.79053, 0.1306],
        [0.86289, 0.79238, 0.13203],
        [0.87127, 0.7942, 0.13346],
        [0.87964, 0.79598, 0.13491],
        [0.88799, 0.79771, 0.13626],
        [0.8963, 0.79937, 0.13769],
        [0.90456, 0.80091, 0.13896],
        [0.91273, 0.80229, 0.14021],
        [0.92077, 0.80347, 0.14138],
        [0.92863, 0.80438, 0.14238],
        [0.93625, 0.80495, 0.14322],
        [0.94355, 0.80511, 0.14385],
        [0.95044, 0.80481, 0.14425],
        [0.95686, 0.80399, 0.14437],
        [0.96274, 0.80262, 0.14419],
        [0.96803, 0.80067, 0.14372],
        [0.9727, 0.79816, 0.14294],
        [0.97674, 0.79512, 0.14188],
        [0.9802, 0.79159, 0.14055],
        [0.9831, 0.78764, 0.13895],
        [0.98551, 0.78333, 0.13721],
        [0.98751, 0.77872, 0.13526],
        [0.98917, 0.77389, 0.13319],
        [0.99056, 0.76889, 0.13103],
        [0.99175, 0.76376, 0.12875],
        [0.99279, 0.75855, 0.12647],
        [0.99371, 0.75327, 0.1241],
        [0.99455, 0.74796, 0.12173],
        [0.99534, 0.74261, 0.11937],
        [0.99608, 0.73724, 0.11697],
        [0.99679, 0.73185, 0.11453],
        [0.99748, 0.72646, 0.11217],
        [0.99814, 0.72104, 0.10976],
        [0.99879, 0.71563, 0.1073],
        [0.99942, 0.71019, 0.1048],
        [1, 0.70475, 0.10238],
        [1, 0.69929, 0.099908],
        [1, 0.69382, 0.09745],
        [1, 0.68834, 0.095],
        [1, 0.68284, 0.092452],
        [1, 0.67734, 0.08996],
        [1, 0.6718, 0.087465],
        [1, 0.66626, 0.08489],
        [1, 0.66071, 0.082364],
        [1, 0.65514, 0.079729],
        [1, 0.64955, 0.077118],
        [1, 0.64394, 0.074554],
        [1, 0.63832, 0.071927],
        [1, 0.63268, 0.069347],
        [1, 0.62702, 0.066593],
        [1, 0.62135, 0.063895],
        [1, 0.61565, 0.061104],
        [1, 0.60993, 0.058355],
        [1, 0.6042, 0.055584],
        [1, 0.59843, 0.052708],
        [1, 0.59265, 0.049893],
        [1, 0.58684, 0.046988],
        [1, 0.58101, 0.043966],
        [1, 0.57515, 0.041014],
        [1, 0.56926, 0.037943],
        [1, 0.56336, 0.034887],
        [1, 0.55742, 0.031822],
        [1, 0.55145, 0.028972],
        [1, 0.54546, 0.026194],
        [1, 0.53942, 0.023487],
        [1, 0.53336, 0.020851],
        [1, 0.52727, 0.018287],
        [1, 0.52114, 0.015792],
        [1, 0.51497, 0.013362],
        [1, 0.50878, 0.010828],
        [1, 0.50252, 0.0085264],
        [1, 0.49623, 0.0063082],
        [1, 0.48991, 0.0041556],
        [1, 0.48353, 0.0020694],
        [1, 0.47711, 4.915e-05],
        [1, 0.47065, 0],
        [1, 0.46413, 0],
        [1, 0.45754, 0],
        [1, 0.45092, 0],
        [1, 0.44423, 0],
        [1, 0.43748, 0],
        [1, 0.43065, 0],
        [1, 0.42375, 0],
        [1, 0.4168, 0],
        [1, 0.40976, 0],
        [1, 0.40263, 0],
        [1, 0.39544, 0],
        [1, 0.38813, 0],
        [1, 0.38075, 0],
        [1, 0.37324, 0],
        [1, 0.36564, 0],
        [1, 0.35792, 0],
        [1, 0.35006, 0],
        [1, 0.34208, 0],
        [1, 0.33395, 0],
        [1, 0.32564, 0],
        [1, 0.31719, 0],
        [1, 0.30856, 0],
        [1, 0.29971, 0],
        [1, 0.29063, 0],
        [1, 0.28132, 0],
        [1, 0.27173, 0],
        [1, 0.26187, 0],
        [1, 0.25167, 0],
        [1, 0.24106, 0],
        [1, 0.23001, 0],
        [1, 0.21851, 0],
        [1, 0.20642, 0],
        [1, 0.19361, 0],
        [1, 0.17996, 0],
        [1, 0.16528, 0],
    ]
    return _cmap("linear_rainbow", cm_data, reverse=reverse)


def cmap_linear_fire(reverse=False):
    # https://github.com/pyviz/colorcet
    # linear colormap, perceptually uniform
    cm_data = [
        [0, 0, 0],
        [0.027065, 2.143e-05, 0],
        [0.052054, 7.4728e-05, 0],
        [0.071511, 0.00013914, 0],
        [0.08742, 0.0002088, 0],
        [0.10109, 0.00028141, 0],
        [0.11337, 0.000356, 2.4266e-17],
        [0.12439, 0.00043134, 3.3615e-17],
        [0.13463, 0.00050796, 2.1604e-17],
        [0.14411, 0.0005856, 0],
        [0.15292, 0.00070304, 0],
        [0.16073, 0.0013432, 0],
        [0.16871, 0.0014516, 0],
        [0.17657, 0.0012408, 0],
        [0.18364, 0.0015336, 0],
        [0.19052, 0.0017515, 0],
        [0.19751, 0.0015146, 0],
        [0.20401, 0.0015249, 0],
        [0.20994, 0.0019639, 0],
        [0.21605, 0.002031, 0],
        [0.22215, 0.0017559, 0],
        [0.22808, 0.001546, 1.8755e-05],
        [0.23378, 0.0016315, 3.5012e-05],
        [0.23955, 0.0017194, 3.3352e-05],
        [0.24531, 0.0018097, 1.8559e-05],
        [0.25113, 0.0019038, 1.9139e-05],
        [0.25694, 0.0020015, 3.5308e-05],
        [0.26278, 0.0021017, 3.2613e-05],
        [0.26864, 0.0022048, 2.0338e-05],
        [0.27451, 0.0023119, 2.2453e-05],
        [0.28041, 0.0024227, 3.6003e-05],
        [0.28633, 0.0025363, 2.9817e-05],
        [0.29229, 0.0026532, 1.9559e-05],
        [0.29824, 0.0027747, 2.7666e-05],
        [0.30423, 0.0028999, 3.5752e-05],
        [0.31026, 0.0030279, 2.3231e-05],
        [0.31628, 0.0031599, 1.2902e-05],
        [0.32232, 0.0032974, 3.2915e-05],
        [0.32838, 0.0034379, 3.2803e-05],
        [0.33447, 0.0035819, 2.0757e-05],
        [0.34057, 0.003731, 2.3831e-05],
        [0.34668, 0.0038848, 3.502e-05],
        [0.35283, 0.0040418, 2.4468e-05],
        [0.35897, 0.0042032, 1.1444e-05],
        [0.36515, 0.0043708, 3.2793e-05],
        [0.37134, 0.0045418, 3.012e-05],
        [0.37756, 0.0047169, 1.4846e-05],
        [0.38379, 0.0048986, 2.796e-05],
        [0.39003, 0.0050848, 3.2782e-05],
        [0.3963, 0.0052751, 1.9244e-05],
        [0.40258, 0.0054715, 2.2667e-05],
        [0.40888, 0.0056736, 3.3223e-05],
        [0.41519, 0.0058798, 2.159e-05],
        [0.42152, 0.0060922, 1.8214e-05],
        [0.42788, 0.0063116, 3.2525e-05],
        [0.43424, 0.0065353, 2.2247e-05],
        [0.44062, 0.006765, 1.5852e-05],
        [0.44702, 0.0070024, 3.1769e-05],
        [0.45344, 0.0072442, 2.1245e-05],
        [0.45987, 0.0074929, 1.5726e-05],
        [0.46631, 0.0077499, 3.0976e-05],
        [0.47277, 0.0080108, 1.8722e-05],
        [0.47926, 0.0082789, 1.9285e-05],
        [0.48574, 0.0085553, 3.0063e-05],
        [0.49225, 0.0088392, 1.4313e-05],
        [0.49878, 0.0091356, 2.3404e-05],
        [0.50531, 0.0094374, 2.8099e-05],
        [0.51187, 0.0097365, 6.4695e-06],
        [0.51844, 0.010039, 2.5791e-05],
        [0.52501, 0.010354, 2.4393e-05],
        [0.53162, 0.010689, 1.6037e-05],
        [0.53825, 0.011031, 2.7295e-05],
        [0.54489, 0.011393, 1.5848e-05],
        [0.55154, 0.011789, 2.3111e-05],
        [0.55818, 0.012159, 2.5416e-05],
        [0.56485, 0.012508, 1.5064e-05],
        [0.57154, 0.012881, 2.541e-05],
        [0.57823, 0.013283, 1.6166e-05],
        [0.58494, 0.013701, 2.263e-05],
        [0.59166, 0.014122, 2.3316e-05],
        [0.59839, 0.014551, 1.9432e-05],
        [0.60514, 0.014994, 2.4323e-05],
        [0.6119, 0.01545, 1.3929e-05],
        [0.61868, 0.01592, 2.1615e-05],
        [0.62546, 0.016401, 1.5846e-05],
        [0.63226, 0.016897, 2.0838e-05],
        [0.63907, 0.017407, 1.9549e-05],
        [0.64589, 0.017931, 2.0961e-05],
        [0.65273, 0.018471, 2.0737e-05],
        [0.65958, 0.019026, 2.0621e-05],
        [0.66644, 0.019598, 2.0675e-05],
        [0.67332, 0.020187, 2.0301e-05],
        [0.68019, 0.020793, 2.0029e-05],
        [0.68709, 0.021418, 2.0088e-05],
        [0.69399, 0.022062, 1.9102e-05],
        [0.70092, 0.022727, 1.9662e-05],
        [0.70784, 0.023412, 1.7757e-05],
        [0.71478, 0.024121, 1.8236e-05],
        [0.72173, 0.024852, 1.4944e-05],
        [0.7287, 0.025608, 2.0245e-06],
        [0.73567, 0.02639, 1.5013e-07],
        [0.74266, 0.027199, 0],
        [0.74964, 0.028038, 0],
        [0.75665, 0.028906, 0],
        [0.76365, 0.029806, 0],
        [0.77068, 0.030743, 0],
        [0.77771, 0.031711, 0],
        [0.78474, 0.032732, 0],
        [0.79179, 0.033741, 0],
        [0.79886, 0.034936, 0],
        [0.80593, 0.036031, 0],
        [0.81299, 0.03723, 0],
        [0.82007, 0.038493, 0],
        [0.82715, 0.039819, 0],
        [0.83423, 0.041236, 0],
        [0.84131, 0.042647, 0],
        [0.84838, 0.044235, 0],
        [0.85545, 0.045857, 0],
        [0.86252, 0.047645, 0],
        [0.86958, 0.049578, 0],
        [0.87661, 0.051541, 0],
        [0.88365, 0.053735, 0],
        [0.89064, 0.056168, 0],
        [0.89761, 0.058852, 0],
        [0.90451, 0.061777, 0],
        [0.91131, 0.065281, 0],
        [0.91796, 0.069448, 0],
        [0.92445, 0.074684, 0],
        [0.93061, 0.08131, 0],
        [0.93648, 0.088878, 0],
        [0.94205, 0.097336, 0],
        [0.9473, 0.10665, 0],
        [0.9522, 0.1166, 0],
        [0.95674, 0.12716, 0],
        [0.96094, 0.13824, 0],
        [0.96479, 0.14963, 0],
        [0.96829, 0.16128, 0],
        [0.97147, 0.17303, 0],
        [0.97436, 0.18489, 0],
        [0.97698, 0.19672, 0],
        [0.97934, 0.20846, 0],
        [0.98148, 0.22013, 0],
        [0.9834, 0.23167, 0],
        [0.98515, 0.24301, 0],
        [0.98672, 0.25425, 0],
        [0.98815, 0.26525, 0],
        [0.98944, 0.27614, 0],
        [0.99061, 0.28679, 0],
        [0.99167, 0.29731, 0],
        [0.99263, 0.30764, 0],
        [0.9935, 0.31781, 0],
        [0.99428, 0.3278, 0],
        [0.995, 0.33764, 0],
        [0.99564, 0.34735, 0],
        [0.99623, 0.35689, 0],
        [0.99675, 0.3663, 0],
        [0.99722, 0.37556, 0],
        [0.99765, 0.38471, 0],
        [0.99803, 0.39374, 0],
        [0.99836, 0.40265, 0],
        [0.99866, 0.41145, 0],
        [0.99892, 0.42015, 0],
        [0.99915, 0.42874, 0],
        [0.99935, 0.43724, 0],
        [0.99952, 0.44563, 0],
        [0.99966, 0.45395, 0],
        [0.99977, 0.46217, 0],
        [0.99986, 0.47032, 0],
        [0.99993, 0.47838, 0],
        [0.99997, 0.48638, 0],
        [1, 0.4943, 0],
        [1, 0.50214, 0],
        [1, 0.50991, 1.2756e-05],
        [1, 0.51761, 4.5388e-05],
        [1, 0.52523, 9.6977e-05],
        [1, 0.5328, 0.00016858],
        [1, 0.54028, 0.0002582],
        [1, 0.54771, 0.00036528],
        [1, 0.55508, 0.00049276],
        [1, 0.5624, 0.00063955],
        [1, 0.56965, 0.00080443],
        [1, 0.57687, 0.00098902],
        [1, 0.58402, 0.0011943],
        [1, 0.59113, 0.0014189],
        [1, 0.59819, 0.0016626],
        [1, 0.60521, 0.0019281],
        [1, 0.61219, 0.0022145],
        [1, 0.61914, 0.0025213],
        [1, 0.62603, 0.0028496],
        [1, 0.6329, 0.0032006],
        [1, 0.63972, 0.0035741],
        [1, 0.64651, 0.0039701],
        [1, 0.65327, 0.0043898],
        [1, 0.66, 0.0048341],
        [1, 0.66669, 0.005303],
        [1, 0.67336, 0.0057969],
        [1, 0.67999, 0.006317],
        [1, 0.68661, 0.0068648],
        [1, 0.69319, 0.0074406],
        [1, 0.69974, 0.0080433],
        [1, 0.70628, 0.0086756],
        [1, 0.71278, 0.0093486],
        [1, 0.71927, 0.010023],
        [1, 0.72573, 0.010724],
        [1, 0.73217, 0.011565],
        [1, 0.73859, 0.012339],
        [1, 0.74499, 0.01316],
        [1, 0.75137, 0.014042],
        [1, 0.75772, 0.014955],
        [1, 0.76406, 0.015913],
        [1, 0.77039, 0.016915],
        [1, 0.77669, 0.017964],
        [1, 0.78298, 0.019062],
        [1, 0.78925, 0.020212],
        [1, 0.7955, 0.021417],
        [1, 0.80174, 0.02268],
        [1, 0.80797, 0.024005],
        [1, 0.81418, 0.025396],
        [1, 0.82038, 0.026858],
        [1, 0.82656, 0.028394],
        [1, 0.83273, 0.030013],
        [1, 0.83889, 0.031717],
        [1, 0.84503, 0.03348],
        [1, 0.85116, 0.035488],
        [1, 0.85728, 0.037452],
        [1, 0.8634, 0.039592],
        [1, 0.86949, 0.041898],
        [1, 0.87557, 0.044392],
        [1, 0.88165, 0.046958],
        [1, 0.88771, 0.04977],
        [1, 0.89376, 0.052828],
        [1, 0.8998, 0.056209],
        [1, 0.90584, 0.059919],
        [1, 0.91185, 0.063925],
        [1, 0.91783, 0.068579],
        [1, 0.92384, 0.073948],
        [1, 0.92981, 0.080899],
        [1, 0.93576, 0.090648],
        [1, 0.94166, 0.10377],
        [1, 0.94752, 0.12051],
        [1, 0.9533, 0.14149],
        [1, 0.959, 0.1672],
        [1, 0.96456, 0.19823],
        [1, 0.96995, 0.23514],
        [1, 0.9751, 0.2786],
        [1, 0.97992, 0.32883],
        [1, 0.98432, 0.38571],
        [1, 0.9882, 0.44866],
        [1, 0.9915, 0.51653],
        [1, 0.99417, 0.58754],
        [1, 0.99625, 0.65985],
        [1, 0.99778, 0.73194],
        [1, 0.99885, 0.80259],
        [1, 0.99953, 0.87115],
        [1, 0.99989, 0.93683],
        [1, 1, 1],
    ]
    return _cmap("linear_fire", cm_data, reverse=reverse)


def cmap_linear_turbo_register():
    plt.register_cmap(name="turbo", cmap=cmap_linear_turbo(False))
    plt.register_cmap(name="turbo_r", cmap=cmap_linear_turbo(True))


def cmap_linear_parula_register():
    plt.register_cmap(name="parula", cmap=cmap_linear_parula(False))
    plt.register_cmap(name="parula_r", cmap=cmap_linear_parula(True))


def cmap_linear_haline_register():
    plt.register_cmap(name="haline", cmap=cmap_linear_haline(False))
    plt.register_cmap(name="haline_r", cmap=cmap_linear_haline(True))


def cmap_linear_thermal_register():
    plt.register_cmap(name="thermal", cmap=cmap_linear_thermal(False))
    plt.register_cmap(name="thermal_r", cmap=cmap_linear_thermal(True))


def cmap_linear_deep_register():
    plt.register_cmap(name="deep", cmap=cmap_linear_deep(False))
    plt.register_cmap(name="deep_r", cmap=cmap_linear_deep(True))


def cmap_linear_bgyw_register():
    plt.register_cmap(name="bgyw", cmap=cmap_linear_bgyw(False))
    plt.register_cmap(name="bgyw_r", cmap=cmap_linear_bgyw(True))


def cmap_linear_bgy_register():
    plt.register_cmap(name="bgy", cmap=cmap_linear_bgy(False))
    plt.register_cmap(name="bgy_r", cmap=cmap_linear_bgy(True))


def cmap_linear_rainbow_register():
    plt.register_cmap(name="rainbow", cmap=cmap_linear_rainbow(False))
    plt.register_cmap(name="rainbow_r", cmap=cmap_linear_rainbow(True))


def cmap_linear_fire_register():
    plt.register_cmap(name="fire", cmap=cmap_linear_fire(False))
    plt.register_cmap(name="fire_r", cmap=cmap_linear_fire(True))


def cmap_cyclic_phase_register():
    plt.register_cmap(name="phase", cmap=cmap_cyclic_phase(False))
    plt.register_cmap(name="phase_r", cmap=cmap_cyclic_phase(True))


def cmap_diverging_curl_register():
    plt.register_cmap(name="curl", cmap=cmap_diverging_curl(False))
    plt.register_cmap(name="curl_r", cmap=cmap_diverging_curl(True))


if __name__ == "__main__":
    cmap_linear_turbo_register()
    cmap_linear_parula_register()
    cmap_linear_haline_register()
    cmap_linear_thermal_register()
    cmap_linear_deep_register()
    cmap_linear_bgyw_register()
    cmap_linear_bgy_register()
    cmap_linear_rainbow_register()
    cmap_linear_fire_register()
    cmap_cyclic_phase_register()
    cmap_diverging_curl_register()

    cmaps = ["viridis", "plasma", "magma", "inferno", "cubehelix", "jet"]
    cmaps += [
        "turbo",
        "rainbow",
        "haline",
        "bgyw",
        "bgy",
        "deep",
        "thermal",
        "fire",
        "phase",
        "curl",
    ]
    n = len(cmaps)

    plt.figure(figsize=(16, 16))
    for cidx, cmap in enumerate(cmaps):
        ax = plt.subplot(n, 1, 1 + cidx)
        ax.imshow(np.linspace(0, 1, 256)[None, :], aspect="auto", cmap=cmap)
        ax.title.set_text(cmap)
    plt.tight_layout()

    plt.figure(figsize=(16, 16))
    for cidx, cmap in enumerate(cmaps):
        cm = plt.get_cmap(cmap)
        im = cm(np.linspace(0, 1, 256)[None, :])
        ax = plt.subplot(n, 1, 1 + cidx)
        # im[..., :3] = np.mean(im[...,:3], axis=2, keepdims=True)
        # ax.imshow(im, aspect='auto')
        im = np.mean(im[..., :3], axis=2)
        ax.imshow(im, aspect="auto", cmap="gray")
        ax.title.set_text(cmap)
    plt.tight_layout()

    plt.show()
